Skip to content

Commit

Permalink
Merge branch 'docs/v2' into refactor/remove-slinky
Browse files Browse the repository at this point in the history
  • Loading branch information
aljo242 committed Sep 17, 2024
2 parents 41fc2bd + d044893 commit 6041a29
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions service/servers/oracle/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,6 @@ func (s *ServerTestSuite) SetupTest() {
dialCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
s.Require().NoError(s.client.Start(dialCtx))

// Health check
for i := 0; ; i++ {
_, err := s.httpClient.Get(fmt.Sprintf("http://%s:%s/slinky/oracle/v1/prices", localhost, port))
if err == nil {
break
}
if i == 10 {
s.T().Fatal("failed to connect to server")
}
time.Sleep(1 * time.Second)
}
}

// teardown test suite.
Expand All @@ -110,7 +98,7 @@ func (s *ServerTestSuite) TearDownTest() {

func (s *ServerTestSuite) TestOracleServerNotRunning() {
// set the mock oracle to not be running
s.mockOracle.On("IsRunning").Return(false)
s.mockOracle.EXPECT().IsRunning().Return(false)

// call from client
_, err := s.client.Prices(context.Background(), &stypes.QueryPricesRequest{})
Expand All @@ -121,7 +109,7 @@ func (s *ServerTestSuite) TestOracleServerNotRunning() {

func (s *ServerTestSuite) TestOracleServerTimeout() {
// set the mock oracle to delay GetPrices response (delay for absurd time)
s.mockOracle.On("IsRunning").Return(true)
s.mockOracle.EXPECT().IsRunning().Return(true)
s.mockOracle.On("GetPrices").Return(nil).After(delay)

// call from client
Expand All @@ -133,7 +121,7 @@ func (s *ServerTestSuite) TestOracleServerTimeout() {

func (s *ServerTestSuite) TestOracleServerPrices() {
// set the mock oracle to return price-data
s.mockOracle.On("IsRunning").Return(true)
s.mockOracle.EXPECT().IsRunning().Return(true)
cp1 := mmtypes.Ticker{
CurrencyPair: connecttypes.CurrencyPair{
Base: "BTC",
Expand Down

0 comments on commit 6041a29

Please sign in to comment.