Merge pull request #14484 from Budibase/fix/sqs-default-dev-on

Enable SQS by default in development
This commit is contained in:
Michael Drury 2024-08-30 18:16:20 +01:00 committed by GitHub
commit 4b5ab43266
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 43 additions and 21 deletions

View File

@ -267,5 +267,5 @@ export class FlagSet<V extends Flag<any>, T extends { [key: string]: V }> {
// default values set correctly and their types flow through the system. // default values set correctly and their types flow through the system.
export const flags = new FlagSet({ export const flags = new FlagSet({
DEFAULT_VALUES: Flag.boolean(false), DEFAULT_VALUES: Flag.boolean(false),
SQS: Flag.boolean(false), SQS: Flag.boolean(env.isDev()),
}) })

View File

@ -47,7 +47,6 @@ async function init() {
HTTP_LOGGING: "0", HTTP_LOGGING: "0",
VERSION: "0.0.0+local", VERSION: "0.0.0+local",
PASSWORD_MIN_LENGTH: "1", PASSWORD_MIN_LENGTH: "1",
TENANT_FEATURE_FLAGS: "*:SQS",
} }
config = { ...config, ...existingConfig } config = { ...config, ...existingConfig }

View File

@ -159,7 +159,7 @@ describe("run misc tests", () => {
const rowThree = rows.find(row => row.e === 3) const rowThree = rows.find(row => row.e === 3)
expect(rowThree.a).toEqual("9") expect(rowThree.a).toEqual("9")
expect(rowThree.f).toEqual(["Two", "Four"]) expect(rowThree.f).toEqual(["Two", "Four"])
expect(rowThree.g).toEqual(null) expect(rowThree.g).toEqual(undefined)
const rowFour = rows.find(row => row.e === 4) const rowFour = rows.find(row => row.e === 4)
expect(rowFour.a).toEqual("13") expect(rowFour.a).toEqual("13")

View File

@ -95,9 +95,11 @@ describe.each([
let envCleanup: (() => void) | undefined let envCleanup: (() => void) | undefined
beforeAll(async () => { beforeAll(async () => {
await withCoreEnv({ TENANT_FEATURE_FLAGS: "*SQS" }, () => config.init()) await withCoreEnv({ TENANT_FEATURE_FLAGS: "*:SQS" }, () => config.init())
if (isSqs) { if (isLucene) {
envCleanup = setCoreEnv({ TENANT_FEATURE_FLAGS: "*SQS" }) envCleanup = setCoreEnv({ TENANT_FEATURE_FLAGS: "*:!SQS" })
} else if (isSqs) {
envCleanup = setCoreEnv({ TENANT_FEATURE_FLAGS: "*:SQS" })
} }
if (dsProvider) { if (dsProvider) {

View File

@ -68,7 +68,11 @@ describe.each([
beforeAll(async () => { beforeAll(async () => {
await withCoreEnv({ TENANT_FEATURE_FLAGS: "*:SQS" }, () => config.init()) await withCoreEnv({ TENANT_FEATURE_FLAGS: "*:SQS" }, () => config.init())
if (isSqs) { if (isLucene) {
envCleanup = setCoreEnv({
TENANT_FEATURE_FLAGS: "*:!SQS",
})
} else if (isSqs) {
envCleanup = setCoreEnv({ envCleanup = setCoreEnv({
TENANT_FEATURE_FLAGS: "*:SQS", TENANT_FEATURE_FLAGS: "*:SQS",
}) })

View File

@ -35,7 +35,7 @@ const { basicTable } = setup.structures
const ISO_REGEX_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/ const ISO_REGEX_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/
describe.each([ describe.each([
["internal", undefined], ["sqs", undefined],
[DatabaseName.POSTGRES, getDatasource(DatabaseName.POSTGRES)], [DatabaseName.POSTGRES, getDatasource(DatabaseName.POSTGRES)],
[DatabaseName.MYSQL, getDatasource(DatabaseName.MYSQL)], [DatabaseName.MYSQL, getDatasource(DatabaseName.MYSQL)],
[DatabaseName.SQL_SERVER, getDatasource(DatabaseName.SQL_SERVER)], [DatabaseName.SQL_SERVER, getDatasource(DatabaseName.SQL_SERVER)],
@ -290,7 +290,7 @@ describe.each([
expected._rev = expect.stringMatching(/^2-.+/) expected._rev = expect.stringMatching(/^2-.+/)
} }
expect(updatedTable).toEqual(expected) expect(updatedTable).toEqual(expect.objectContaining(expected))
const persistedTable = await config.api.table.get(updatedTable._id!) const persistedTable = await config.api.table.get(updatedTable._id!)
expected = { expected = {
@ -304,7 +304,7 @@ describe.each([
if (isInternal) { if (isInternal) {
expected._rev = expect.stringMatching(/^2-.+/) expected._rev = expect.stringMatching(/^2-.+/)
} }
expect(persistedTable).toEqual(expected) expect(persistedTable).toEqual(expect.objectContaining(expected))
}) })
}) })
@ -687,7 +687,7 @@ describe.each([
basicTable(datasource, { name: generator.guid() }) basicTable(datasource, { name: generator.guid() })
) )
const res = await config.api.table.get(table._id!) const res = await config.api.table.get(table._id!)
expect(res).toEqual(table) expect(res).toEqual(expect.objectContaining(table))
}) })
}) })
@ -727,10 +727,12 @@ describe.each([
body: { message: `Table ${testTable._id} deleted.` }, body: { message: `Table ${testTable._id} deleted.` },
}) })
expect(events.table.deleted).toHaveBeenCalledTimes(1) expect(events.table.deleted).toHaveBeenCalledTimes(1)
expect(events.table.deleted).toHaveBeenCalledWith({ expect(events.table.deleted).toHaveBeenCalledWith(
...testTable, expect.objectContaining({
tableId: testTable._id, ...testTable,
}) tableId: testTable._id,
})
)
}) })
it("deletes linked references to the table after deletion", async () => { it("deletes linked references to the table after deletion", async () => {

View File

@ -444,7 +444,10 @@ describe("/views", () => {
assertJsonExport(res) assertJsonExport(res)
expect(events.table.exported).toHaveBeenCalledTimes(1) expect(events.table.exported).toHaveBeenCalledTimes(1)
expect(events.table.exported).toHaveBeenCalledWith(table, "json") expect(events.table.exported).toHaveBeenCalledWith(
expect.objectContaining(table),
"json"
)
}) })
it("should be able to export a table as CSV", async () => { it("should be able to export a table as CSV", async () => {
@ -454,7 +457,10 @@ describe("/views", () => {
assertCSVExport(res) assertCSVExport(res)
expect(events.table.exported).toHaveBeenCalledTimes(1) expect(events.table.exported).toHaveBeenCalledTimes(1)
expect(events.table.exported).toHaveBeenCalledWith(table, "csv") expect(events.table.exported).toHaveBeenCalledWith(
expect.objectContaining(table),
"csv"
)
}) })
it("should be able to export a view as JSON", async () => { it("should be able to export a view as JSON", async () => {

View File

@ -97,7 +97,11 @@ describe.each([
await withCoreEnv({ TENANT_FEATURE_FLAGS: isSqs ? "*:SQS" : "" }, () => await withCoreEnv({ TENANT_FEATURE_FLAGS: isSqs ? "*:SQS" : "" }, () =>
config.init() config.init()
) )
if (isSqs) { if (isLucene) {
envCleanup = setCoreEnv({
TENANT_FEATURE_FLAGS: "*:!SQS",
})
} else if (isSqs) {
envCleanup = setCoreEnv({ envCleanup = setCoreEnv({
TENANT_FEATURE_FLAGS: "*:SQS", TENANT_FEATURE_FLAGS: "*:SQS",
}) })

View File

@ -45,7 +45,11 @@ describe.each([
config.init() config.init()
) )
if (isSqs) { if (isLucene) {
envCleanup = setCoreEnv({
TENANT_FEATURE_FLAGS: "*:!SQS",
})
} else if (isSqs) {
envCleanup = setCoreEnv({ envCleanup = setCoreEnv({
TENANT_FEATURE_FLAGS: "*:SQS", TENANT_FEATURE_FLAGS: "*:SQS",
}) })

View File

@ -30,7 +30,6 @@ async function init() {
HTTP_LOGGING: "0", HTTP_LOGGING: "0",
VERSION: "0.0.0+local", VERSION: "0.0.0+local",
PASSWORD_MIN_LENGTH: "1", PASSWORD_MIN_LENGTH: "1",
TENANT_FEATURE_FLAGS: "*:SQS",
} }
config = { ...config, ...existingConfig } config = { ...config, ...existingConfig }

View File

@ -17,7 +17,9 @@ describe.each(["lucene", "sql"])("/api/global/auditlogs (%s)", method => {
let envCleanup: (() => void) | undefined let envCleanup: (() => void) | undefined
beforeAll(async () => { beforeAll(async () => {
if (method === "sql") { if (method === "lucene") {
envCleanup = setCoreEnv({ TENANT_FEATURE_FLAGS: "*:!SQS" })
} else if (method === "sql") {
envCleanup = setCoreEnv({ TENANT_FEATURE_FLAGS: "*:SQS" }) envCleanup = setCoreEnv({ TENANT_FEATURE_FLAGS: "*:SQS" })
} }
await config.beforeAll() await config.beforeAll()