@@ -50,13 +50,17 @@ func TestBackupMultiTenancy(t *testing.T) {
50
50
dg := testutil .DgClientWithLogin (t , "groot" , "password" , x .GalaxyNamespace )
51
51
testutil .DropAll (t , dg )
52
52
53
- galaxyCreds := & testutil.LoginParams {UserID : "groot" , Passwd : "password" , Namespace : x .GalaxyNamespace }
53
+ galaxyCreds := & testutil.LoginParams {
54
+ UserID : "groot" , Passwd : "password" , Namespace : x .GalaxyNamespace }
54
55
galaxyToken := testutil .Login (t , galaxyCreds )
55
56
56
57
// Create a new namespace
57
- ns , err := testutil .CreateNamespaceWithRetry (t , galaxyToken )
58
+ ns1 , err := testutil .CreateNamespaceWithRetry (t , galaxyToken )
58
59
require .NoError (t , err )
59
- dg1 := testutil .DgClientWithLogin (t , "groot" , "password" , ns )
60
+ ns2 , err := testutil .CreateNamespaceWithRetry (t , galaxyToken )
61
+ require .NoError (t , err )
62
+ dg1 := testutil .DgClientWithLogin (t , "groot" , "password" , ns1 )
63
+ dg2 := testutil .DgClientWithLogin (t , "groot" , "password" , ns2 )
60
64
61
65
addSchema := func (dg * dgo.Dgraph ) {
62
66
// Add schema and types.
@@ -69,6 +73,7 @@ func TestBackupMultiTenancy(t *testing.T) {
69
73
70
74
addSchema (dg )
71
75
addSchema (dg1 )
76
+ addSchema (dg2 )
72
77
73
78
addData := func (dg * dgo.Dgraph , name string ) * api.Response {
74
79
var buf bytes.Buffer
@@ -96,7 +101,8 @@ func TestBackupMultiTenancy(t *testing.T) {
96
101
97
102
original := make (map [uint64 ]* api.Response )
98
103
original [x .GalaxyNamespace ] = addData (dg , "galaxy" )
99
- original [ns ] = addData (dg1 , "ns" )
104
+ original [ns1 ] = addData (dg1 , "ns1" )
105
+ original [ns2 ] = addData (dg2 , "ns2" )
100
106
101
107
// Setup test directories.
102
108
common .DirSetup (t )
@@ -111,11 +117,23 @@ func TestBackupMultiTenancy(t *testing.T) {
111
117
expectedResponse := `{ "q": [{ "count": 5 }]}`
112
118
testutil .VerifyQueryResponse (t , dg , query , expectedResponse )
113
119
testutil .VerifyQueryResponse (t , dg1 , query , expectedResponse )
120
+ testutil .VerifyQueryResponse (t , dg2 , query , expectedResponse )
121
+
122
+ // Call drop data from namespace ns2.
123
+ require .NoError (t , dg2 .Alter (ctx , & api.Operation {DropOp : api .Operation_DATA }))
124
+ // Send backup request.
125
+ _ = runBackup (t , galaxyToken , 6 , 2 )
126
+ testutil .DropAll (t , dg )
127
+ sendRestoreRequest (t , alphaBackupDir , galaxyToken .AccessJwt )
128
+ testutil .WaitForRestore (t , dg )
129
+ testutil .VerifyQueryResponse (t , dg , query , expectedResponse )
130
+ testutil .VerifyQueryResponse (t , dg1 , query , expectedResponse )
131
+ testutil .VerifyQueryResponse (t , dg2 , query , `{ "q": [{ "count": 0 }]}` )
114
132
115
133
// After deleting a namespace in incremental backup, we should not be able to get the data from
116
134
// banned namespace.
117
- require .NoError (t , testutil .DeleteNamespace (t , galaxyToken , ns ))
118
- _ = runBackup (t , galaxyToken , 6 , 2 )
135
+ require .NoError (t , testutil .DeleteNamespace (t , galaxyToken , ns1 ))
136
+ _ = runBackup (t , galaxyToken , 9 , 3 )
119
137
testutil .DropAll (t , dg )
120
138
sendRestoreRequest (t , alphaBackupDir , galaxyToken .AccessJwt )
121
139
testutil .WaitForRestore (t , dg )
0 commit comments