2022-05-18 16:12:54 +00:00
|
|
|
// VulcanizeDB
|
|
|
|
// Copyright © 2022 Vulcanize
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2022-04-25 15:32:46 +00:00
|
|
|
package beaconclient_test
|
2022-04-25 14:41:50 +00:00
|
|
|
|
|
|
|
import (
|
2022-04-26 17:57:01 +00:00
|
|
|
"context"
|
|
|
|
|
2022-04-25 14:41:50 +00:00
|
|
|
. "github.com/onsi/ginkgo/v2"
|
|
|
|
. "github.com/onsi/gomega"
|
2022-06-09 21:32:46 +00:00
|
|
|
beaconclient "github.com/vulcanize/ipld-eth-beacon-indexer/pkg/beaconclient"
|
2022-04-25 14:41:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var _ = Describe("Healthcheck", func() {
|
|
|
|
var (
|
2022-06-03 16:47:13 +00:00
|
|
|
Bc *beaconclient.BeaconClient
|
2022-05-25 14:19:29 +00:00
|
|
|
errBc *beaconclient.BeaconClient
|
2022-04-25 14:41:50 +00:00
|
|
|
)
|
2022-05-25 14:19:29 +00:00
|
|
|
|
|
|
|
BeforeEach(func() {
|
2022-06-03 16:47:13 +00:00
|
|
|
var err error
|
2022-09-29 01:39:56 +00:00
|
|
|
Bc, err = beaconclient.CreateBeaconClient(context.Background(), "http", "localhost", 5052, 10, bcUniqueIdentifier, false, true, true)
|
2022-06-03 16:47:13 +00:00
|
|
|
Expect(err).ToNot(HaveOccurred())
|
2022-09-29 01:39:56 +00:00
|
|
|
errBc, err = beaconclient.CreateBeaconClient(context.Background(), "http", "blah-blah", 1010, 10, bcUniqueIdentifier, false, true, true)
|
2022-06-03 16:47:13 +00:00
|
|
|
Expect(err).ToNot(HaveOccurred())
|
2022-05-25 14:19:29 +00:00
|
|
|
})
|
2022-04-25 14:41:50 +00:00
|
|
|
Describe("Connecting to the lighthouse client", Label("integration"), func() {
|
|
|
|
Context("When the client is running", func() {
|
|
|
|
It("We should connect successfully", func() {
|
2022-06-03 16:47:13 +00:00
|
|
|
err := Bc.CheckBeaconClient()
|
2022-04-25 14:41:50 +00:00
|
|
|
Expect(err).To(BeNil())
|
|
|
|
})
|
|
|
|
})
|
2022-04-26 17:57:01 +00:00
|
|
|
Context("When the client is not running", func() {
|
|
|
|
It("We not should connect successfully", func() {
|
2022-04-25 15:32:46 +00:00
|
|
|
err := errBc.CheckBeaconClient()
|
2022-04-25 14:41:50 +00:00
|
|
|
Expect(err).ToNot(BeNil())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|