MCPcopy
hub / github.com/dgraph-io/dgraph / admin

Function admin

graphql/e2e/common/admin.go:154–187  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

152)
153
154func admin(t *testing.T) {
155 d, err := grpc.NewClient(Alpha1gRPC, grpc.WithTransportCredentials(insecure.NewCredentials()))
156 require.NoError(t, err)
157
158 oldCounter := RetryProbeGraphQL(t, Alpha1HTTP, nil).SchemaUpdateCounter
159 client := dgo.NewDgraphClient(api.NewDgraphClient(d))
160 testutil.DropAll(t, client)
161 AssertSchemaUpdateCounterIncrement(t, Alpha1HTTP, oldCounter, nil)
162
163 hasSchema, err := hasCurrentGraphQLSchema(GraphqlAdminURL)
164 require.NoError(t, err)
165 require.False(t, hasSchema)
166
167 schemaIsInInitialState(t, client)
168 addGQLSchema(t, client)
169 updateSchema(t, client)
170 updateSchemaThroughAdminSchemaEndpt(t, client)
171 gqlSchemaNodeHasXid(t, client)
172
173 // restore the state to the initial schema and data.
174 testutil.DropAll(t, client)
175
176 schemaFile := "schema.graphql"
177 schema, err := os.ReadFile(schemaFile)
178 x.Panic(err)
179
180 jsonFile := "test_data.json"
181 data, err := os.ReadFile(jsonFile)
182 if err != nil {
183 panic(errors.Wrapf(err, "Unable to read file %s.", jsonFile))
184 }
185
186 addSchemaAndData(schema, data, client, nil)
187}
188
189func schemaIsInInitialState(t *testing.T, client *dgo.Dgraph) {
190 testutil.VerifySchema(t, client, testutil.SchemaOptions{ExcludeAclSchema: true})

Callers

nothing calls this directly

Calls 11

DropAllFunction · 0.92
PanicFunction · 0.92
RetryProbeGraphQLFunction · 0.85
hasCurrentGraphQLSchemaFunction · 0.85
schemaIsInInitialStateFunction · 0.85
addGQLSchemaFunction · 0.85
gqlSchemaNodeHasXidFunction · 0.85
addSchemaAndDataFunction · 0.85
updateSchemaFunction · 0.70

Tested by

no test coverage detected