MCPcopy
hub / github.com/openfga/openfga / TestServerNotReadyDueToDatastoreRevision

Function TestServerNotReadyDueToDatastoreRevision

pkg/server/server_test.go:245–267  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

243}
244
245func TestServerNotReadyDueToDatastoreRevision(t *testing.T) {
246 // skipping sqlite here because the lowest supported schema revision is 4
247 engines := []string{"postgres", "mysql"}
248
249 for _, engine := range engines {
250 t.Run(engine, func(t *testing.T) {
251 _, ds, uri := util.MustBootstrapDatastore(t, engine)
252
253 targetVersion := build.MinimumSupportedDatastoreSchemaRevision - 1
254
255 migrateCommand := migrate.NewMigrateCommand()
256
257 migrateCommand.SetArgs([]string{"--datastore-engine", engine, "--datastore-uri", uri, "--version", strconv.Itoa(int(targetVersion))})
258
259 err := migrateCommand.Execute()
260 require.NoError(t, err)
261
262 status, _ := ds.IsReady(context.Background())
263 require.Contains(t, status.Message, fmt.Sprintf("datastore requires migrations: at revision '%d', but requires '%d'.", targetVersion, build.MinimumSupportedDatastoreSchemaRevision))
264 require.False(t, status.IsReady)
265 })
266 }
267}
268
269func TestServerPanicIfEmptyRequestDurationDatastoreCountBuckets(t *testing.T) {
270 require.PanicsWithError(t, "failed to construct the OpenFGA server: request duration datastore count buckets must not be empty", func() {

Callers

nothing calls this directly

Calls 5

MustBootstrapDatastoreFunction · 0.92
NewMigrateCommandFunction · 0.92
RunMethod · 0.80
ExecuteMethod · 0.65
IsReadyMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…