Skip to content

Commit

Permalink
chore(test): Improvements in 127+ namespace restore test (#8691)
Browse files Browse the repository at this point in the history
* Made changes in parameters passed to the function
   GetJwtTokenAndHeader()
* Made changes in GetJwtTokenAndHeader() definition,
   which will return the correct jwtToken and header for
   given namespaceId
  • Loading branch information
SiddeshUbale authored Feb 24, 2023
1 parent 5bf1b75 commit d981392
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func Test127PlusNamespaces(t *testing.T) {
e2eCommon.AssertGetGQLSchema(t, testutil.ContainerAddr("alpha2", 8080), headerAlpha2Np0)
utilsCommon.CheckItemExists(t, 30, jwtTokenAlpha2Np0, "alpha2")
_ = e2eCommon.CreateNamespaces(t, headerAlpha1Np0, "alpha1", 50)
jwtTokenAlpha1Np51, headerAlpha1Np51 := utilsCommon.GetJwtTokenAndHeader(t, "alpha1", 0)
jwtTokenAlpha1Np51, headerAlpha1Np51 := utilsCommon.GetJwtTokenAndHeader(t, "alpha1", 51)
utilsCommon.AddItemSchema(t, headerAlpha1Np51, "alpha1")
e2eCommon.AssertGetGQLSchema(t, testutil.ContainerAddr("alpha1", 8080), headerAlpha1Np51)
utilsCommon.AddItem(t, 51, 100, jwtTokenAlpha1Np51, "alpha1")
Expand All @@ -43,11 +43,11 @@ func Test127PlusNamespaces(t *testing.T) {
testutil.WaitForRestore(t, dg2, testutil.ContainerAddr("alpha2", 8080))
e2eCommon.AssertGetGQLSchema(t, testutil.ContainerAddr("alpha2", 8080), headerAlpha2Np0)
utilsCommon.CheckItemExists(t, 30, jwtTokenAlpha2Np0, "alpha2")
jwtTokenAlpha2Np51, headerAlpha2Np51 := utilsCommon.GetJwtTokenAndHeader(t, "alpha1", 0)
jwtTokenAlpha2Np51, headerAlpha2Np51 := utilsCommon.GetJwtTokenAndHeader(t, "alpha1", 51)
e2eCommon.AssertGetGQLSchema(t, testutil.ContainerAddr("alpha2", 8080), headerAlpha2Np51)
utilsCommon.CheckItemExists(t, 70, jwtTokenAlpha2Np51, "alpha2")
_ = e2eCommon.CreateNamespaces(t, headerAlpha1Np0, "alpha1", 30)
jwtTokenAlpha1Np130, headerAlpha1Np130 := utilsCommon.GetJwtTokenAndHeader(t, "alpha1", 0)
jwtTokenAlpha1Np130, headerAlpha1Np130 := utilsCommon.GetJwtTokenAndHeader(t, "alpha1", 130)
utilsCommon.AddItemSchema(t, headerAlpha1Np130, "alpha1")
e2eCommon.AssertGetGQLSchema(t, testutil.ContainerAddr("alpha1", 8080), headerAlpha1Np130)
utilsCommon.AddItem(t, 101, 130, jwtTokenAlpha1Np130, "alpha1")
Expand All @@ -60,7 +60,7 @@ func Test127PlusNamespaces(t *testing.T) {
utilsCommon.CheckItemExists(t, 30, jwtTokenAlpha2Np0, "alpha2")
e2eCommon.AssertGetGQLSchema(t, testutil.ContainerAddr("alpha2", 8080), headerAlpha2Np51)
utilsCommon.CheckItemExists(t, 70, jwtTokenAlpha2Np51, "alpha2")
jwtTokenAlpha2Np130, headerAlpha2Np130 := utilsCommon.GetJwtTokenAndHeader(t, "alpha1", 0)
jwtTokenAlpha2Np130, headerAlpha2Np130 := utilsCommon.GetJwtTokenAndHeader(t, "alpha1", 130)
e2eCommon.AssertGetGQLSchema(t, testutil.ContainerAddr("alpha2", 8080), headerAlpha2Np130)
utilsCommon.CheckItemExists(t, 110, jwtTokenAlpha2Np130, "alpha2")
}
4 changes: 2 additions & 2 deletions systest/backup/common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ func RunRestore(t *testing.T, jwtToken string, restoreLocation string, whichAlph

func GetJwtTokenAndHeader(t *testing.T, whichAlpha string, namespaceId uint64) (string, http.Header) {
var header = http.Header{}

jwtToken := testutil.GrootHttpLoginNamespace("http://"+testutil.ContainerAddr(whichAlpha, 8080)+"/admin", 0).AccessJwt
adminUrl := "http://" + testutil.ContainerAddr(whichAlpha, 8080) + "/admin"
jwtToken := testutil.GrootHttpLoginNamespace(adminUrl, namespaceId).AccessJwt
header.Set(accessJwtHeader, jwtToken)
header.Set("Content-Type", "application/json")

Expand Down

0 comments on commit d981392

Please sign in to comment.