Skip to content

Commit

Permalink
test: add v3 curl test to cover maintenance hash/hashkv REST API
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Wang <wachao@vmware.com>
Signed-off-by: Wei Fu <fuweid89@gmail.com>
  • Loading branch information
fuweid committed Aug 27, 2023
1 parent 83bf5dc commit 0fe3d57
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/e2e/v3_curl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,34 @@ func testV3CurlMaintenanceAlarmMissiongAlarm(cx ctlCtx) {
}
}

func TestV3CurlMaintenanceHash(t *testing.T) {
testCtl(t, testV3CurlMaintenanceHash, withCfg(*newConfigNoTLS()))
}

func testV3CurlMaintenanceHash(cx ctlCtx) {
if err := cURLPost(cx.epc, cURLReq{
endpoint: "/v3/maintenance/hash",
value: "{}",
expected: `,"revision":"1","raft_term":"2"}`,
}); err != nil {
cx.t.Fatalf("failed post maintenance hash request (%s) (%v)", cx.apiPrefix, err)
}
}

func TestV3CurlMaintenanceHashKV(t *testing.T) {
testCtl(t, testV3CurlMaintenanceHashKV, withCfg(*newConfigNoTLS()))
}

func testV3CurlMaintenanceHashKV(cx ctlCtx) {
if err := cURLPost(cx.epc, cURLReq{
endpoint: "/v3/maintenance/hashkv",
value: `{"revision": 1}`,
expected: `,"revision":"1","raft_term":"2"}`,
}); err != nil {
cx.t.Fatalf("failed post maintenance hashKV request (%s) (%v)", cx.apiPrefix, err)
}
}

// to manually decode; JSON marshals integer fields with
// string types, so can't unmarshal with epb.CampaignResponse
type campaignResponse struct {
Expand Down

0 comments on commit 0fe3d57

Please sign in to comment.