(t *testing.T)
| 38 | } |
| 39 | |
| 40 | func TestCheckUpgrade(t *testing.T) { |
| 41 | skipIfFIPS(t) |
| 42 | conf := dgraphtest.NewClusterConfig().WithNumAlphas(1).WithNumZeros(1).WithReplicas(1). |
| 43 | WithACL(time.Hour).WithVersion("57aa5c4ac") |
| 44 | c, err := dgraphtest.NewLocalCluster(conf) |
| 45 | require.NoError(t, err) |
| 46 | defer func() { c.Cleanup(t.Failed()) }() |
| 47 | require.NoError(t, c.Start()) |
| 48 | |
| 49 | gc, cleanup, err := c.Client() |
| 50 | require.NoError(t, err) |
| 51 | defer cleanup() |
| 52 | require.NoError(t, gc.LoginIntoNamespace(context.Background(), |
| 53 | dgraphapi.DefaultUser, dgraphapi.DefaultPassword, x.RootNamespace)) |
| 54 | |
| 55 | hc, err := c.HTTPClient() |
| 56 | require.NoError(t, err) |
| 57 | require.NoError(t, hc.LoginIntoNamespace(dgraphapi.DefaultUser, |
| 58 | dgraphapi.DefaultPassword, x.RootNamespace)) |
| 59 | |
| 60 | rdfs := ` |
| 61 | _:a <dgraph.xid> "user1" . |
| 62 | _:a <dgraph.type> "dgraph.type.User" . |
| 63 | _:b <dgraph.xid> "user1" . |
| 64 | _:b <dgraph.type> "dgraph.type.User" .` |
| 65 | |
| 66 | mu := &api.Mutation{SetNquads: []byte(rdfs), CommitNow: true} |
| 67 | _, err = gc.Mutate(mu) |
| 68 | require.NoError(t, err) |
| 69 | |
| 70 | var nss []uint64 |
| 71 | for i := 0; i < 5; i++ { |
| 72 | ns, err := hc.AddNamespace() |
| 73 | require.NoError(t, err) |
| 74 | require.NoError(t, gc.LoginIntoNamespace(context.Background(), "groot", "password", ns)) |
| 75 | mu = &api.Mutation{SetNquads: []byte(rdfs), CommitNow: true} |
| 76 | _, err = gc.Mutate(mu) |
| 77 | require.NoError(t, err) |
| 78 | nss = append(nss, ns) |
| 79 | } |
| 80 | |
| 81 | conf1 := dgraphtest.NewClusterConfig().WithNumAlphas(1).WithNumZeros(1).WithReplicas(1).WithACL(time.Hour).WithVersion("local") |
| 82 | c1, err := dgraphtest.NewLocalCluster(conf1) |
| 83 | require.NoError(t, err) |
| 84 | defer func() { c1.Cleanup(t.Failed()) }() |
| 85 | require.NoError(t, c1.Start()) |
| 86 | alphaHttp, err := c.GetAlphaHttpPublicPort(0) |
| 87 | require.NoError(t, err) |
| 88 | |
| 89 | args := []string{ |
| 90 | "checkupgrade", |
| 91 | "--http_port", "localhost:" + alphaHttp, |
| 92 | "--dgUser", "groot", |
| 93 | "--password", "password", |
| 94 | "--namespace", "1", |
| 95 | } |
| 96 | |
| 97 | cmd := exec.Command(c1.HostDgraphBinaryPath(), args...) |
nothing calls this directly
no test coverage detected