(t *testing.T)
| 243 | } |
| 244 | |
| 245 | func 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 | |
| 269 | func TestServerPanicIfEmptyRequestDurationDatastoreCountBuckets(t *testing.T) { |
| 270 | require.PanicsWithError(t, "failed to construct the OpenFGA server: request duration datastore count buckets must not be empty", func() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…