Skip to content

Commit

Permalink
edit test function
Browse files Browse the repository at this point in the history
Signed-off-by: Boyang Lyu <[email protected]>
  • Loading branch information
JackL9u committed Aug 8, 2024
1 parent 870f9cc commit be5c4a1
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions tests/integrations/client/http_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,22 @@ func (suite *httpClientTestSuite) SetupSuite() {
GCSafePoint: 1,
MinServiceGcSafepoint: 1,
}
for _, s := range testServers {
storage := s.GetServer().GetStorage()
for _, ssp := range list.ServiceGCSafepoints {
err := storage.SaveServiceGCSafePoint(ssp)
re.NoError(err)
}
storage.SaveGCSafePoint(1)

storage := suite.cluster.GetLeaderServer().GetServer().GetStorage()
for _, ssp := range list.ServiceGCSafepoints {
err := storage.SaveServiceGCSafePoint(ssp)
re.NoError(err)
}
storage.SaveGCSafePoint(1)

// for _, s := range testServers {
// storage := s.GetServer().GetStorage()
// for _, ssp := range list.ServiceGCSafepoints {
// err := storage.SaveServiceGCSafePoint(ssp)
// re.NoError(err)
// }
// storage.SaveGCSafePoint(1)
// }

if suite.withServiceDiscovery {
// Run test with specific service discovery.
Expand Down Expand Up @@ -870,7 +878,11 @@ func (suite *httpClientTestSuite) TestRetryOnLeaderChange() {

func (suite *httpClientTestSuite) TestGetSafePoint() {
re := suite.Require()
l, err := suite.client.GetGCSafePoint(suite.ctx)
client := suite.client
ctx, cancel := context.WithCancel(suite.ctx)
defer cancel()

l, err := client.GetGCSafePoint(ctx)
re.NoError(err)

re.Equal(uint64(1), l.GCSafePoint)
Expand All @@ -897,18 +909,22 @@ func (suite *httpClientTestSuite) TestGetSafePoint() {

func (suite *httpClientTestSuite) TestDeleteSafePoint() {
re := suite.Require()
msg1, err1 := suite.client.DeleteGCSafePoint(suite.ctx, "AAA")
client := suite.client
ctx, cancel := context.WithCancel(suite.ctx)
defer cancel()

msg1, err1 := client.DeleteGCSafePoint(ctx, "AAA")
re.NoError(err1)
re.Equal("Delete service GC safepoint successfully.", msg1)

msg2, err2 := suite.client.DeleteGCSafePoint(suite.ctx, "BBB")
msg2, err2 := client.DeleteGCSafePoint(ctx, "BBB")
re.NoError(err2)
re.Equal("Delete service GC safepoint successfully.", msg2)

msg3, err3 := suite.client.DeleteGCSafePoint(suite.ctx, "DDD")
msg3, err3 := client.DeleteGCSafePoint(ctx, "DDD")
re.NoError(err3)
re.Equal("Delete service GC safepoint successfully.", msg3)

_, err4 := suite.client.DeleteGCSafePoint(suite.ctx, "gc_worker")
_, err4 := client.DeleteGCSafePoint(ctx, "gc_worker")
re.Error(err4)
}

0 comments on commit be5c4a1

Please sign in to comment.