(t *testing.T)
| 152 | ) |
| 153 | |
| 154 | func 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 | |
| 189 | func schemaIsInInitialState(t *testing.T, client *dgo.Dgraph) { |
| 190 | testutil.VerifySchema(t, client, testutil.SchemaOptions{ExcludeAclSchema: true}) |
nothing calls this directly
no test coverage detected