Cleanup sqs flags from tests
This commit is contained in:
parent
1a572036f7
commit
e7d4f90f1b
|
@ -10,7 +10,7 @@ import {
|
||||||
import TestConfiguration from "../../../../../tests/utilities/TestConfiguration"
|
import TestConfiguration from "../../../../../tests/utilities/TestConfiguration"
|
||||||
import { search } from "../../../../../sdk/app/rows/search"
|
import { search } from "../../../../../sdk/app/rows/search"
|
||||||
import { generator } from "@budibase/backend-core/tests"
|
import { generator } from "@budibase/backend-core/tests"
|
||||||
import { features } from "@budibase/backend-core"
|
|
||||||
import {
|
import {
|
||||||
DatabaseName,
|
DatabaseName,
|
||||||
getDatasource,
|
getDatasource,
|
||||||
|
@ -21,30 +21,20 @@ import { tableForDatasource } from "../../../../../tests/utilities/structures"
|
||||||
// (e.g. limiting searches to returning specific fields). If it's possible to
|
// (e.g. limiting searches to returning specific fields). If it's possible to
|
||||||
// test through the API, it should be done there instead.
|
// test through the API, it should be done there instead.
|
||||||
describe.each([
|
describe.each([
|
||||||
["lucene", undefined],
|
["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)],
|
||||||
[DatabaseName.MARIADB, getDatasource(DatabaseName.MARIADB)],
|
[DatabaseName.MARIADB, getDatasource(DatabaseName.MARIADB)],
|
||||||
])("search sdk (%s)", (name, dsProvider) => {
|
])("search sdk (%s)", (name, dsProvider) => {
|
||||||
const isSqs = name === "sqs"
|
const isInternal = name === "internal"
|
||||||
const isLucene = name === "lucene"
|
|
||||||
const isInternal = isLucene || isSqs
|
|
||||||
const config = new TestConfiguration()
|
const config = new TestConfiguration()
|
||||||
|
|
||||||
let envCleanup: (() => void) | undefined
|
|
||||||
let datasource: Datasource | undefined
|
let datasource: Datasource | undefined
|
||||||
let table: Table
|
let table: Table
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await features.testutils.withFeatureFlags("*", { SQS: isSqs }, () =>
|
await config.init()
|
||||||
config.init()
|
|
||||||
)
|
|
||||||
|
|
||||||
envCleanup = features.testutils.setFeatureFlags("*", {
|
|
||||||
SQS: isSqs,
|
|
||||||
})
|
|
||||||
|
|
||||||
if (dsProvider) {
|
if (dsProvider) {
|
||||||
datasource = await config.createDatasource({
|
datasource = await config.createDatasource({
|
||||||
|
@ -105,9 +95,6 @@ describe.each([
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
config.end()
|
config.end()
|
||||||
if (envCleanup) {
|
|
||||||
envCleanup()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it("querying by fields will always return data attribute columns", async () => {
|
it("querying by fields will always return data attribute columns", async () => {
|
||||||
|
@ -211,36 +198,35 @@ describe.each([
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
!isLucene &&
|
it.each([
|
||||||
it.each([
|
[["id", "name", "age"], 3],
|
||||||
[["id", "name", "age"], 3],
|
[["name", "age"], 10],
|
||||||
[["name", "age"], 10],
|
])(
|
||||||
])(
|
"cannot query by non search fields (fields: %s)",
|
||||||
"cannot query by non search fields (fields: %s)",
|
async (queryFields, expectedRows) => {
|
||||||
async (queryFields, expectedRows) => {
|
await config.doInContext(config.appId, async () => {
|
||||||
await config.doInContext(config.appId, async () => {
|
const { rows } = await search({
|
||||||
const { rows } = await search({
|
tableId: table._id!,
|
||||||
tableId: table._id!,
|
query: {
|
||||||
query: {
|
$or: {
|
||||||
$or: {
|
conditions: [
|
||||||
conditions: [
|
{
|
||||||
{
|
$and: {
|
||||||
$and: {
|
conditions: [
|
||||||
conditions: [
|
{ range: { id: { low: 2, high: 4 } } },
|
||||||
{ range: { id: { low: 2, high: 4 } } },
|
{ range: { id: { low: 3, high: 5 } } },
|
||||||
{ range: { id: { low: 3, high: 5 } } },
|
],
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{ equal: { id: 7 } },
|
},
|
||||||
],
|
{ equal: { id: 7 } },
|
||||||
},
|
],
|
||||||
},
|
},
|
||||||
fields: queryFields,
|
},
|
||||||
})
|
fields: queryFields,
|
||||||
|
|
||||||
expect(rows).toHaveLength(expectedRows)
|
|
||||||
})
|
})
|
||||||
}
|
|
||||||
)
|
expect(rows).toHaveLength(expectedRows)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { mocks, structures } from "@budibase/backend-core/tests"
|
import { mocks, structures } from "@budibase/backend-core/tests"
|
||||||
import { context, events, features } from "@budibase/backend-core"
|
import { context, events } from "@budibase/backend-core"
|
||||||
import { Event, IdentityType } from "@budibase/types"
|
import { Event, IdentityType } from "@budibase/types"
|
||||||
import { TestConfiguration } from "../../../../tests"
|
import { TestConfiguration } from "../../../../tests"
|
||||||
|
|
||||||
|
@ -12,19 +12,14 @@ const BASE_IDENTITY = {
|
||||||
const USER_AUDIT_LOG_COUNT = 3
|
const USER_AUDIT_LOG_COUNT = 3
|
||||||
const APP_ID = "app_1"
|
const APP_ID = "app_1"
|
||||||
|
|
||||||
describe.each(["lucene", "sql"])("/api/global/auditlogs (%s)", method => {
|
describe("/api/global/auditlogs (%s)", () => {
|
||||||
const config = new TestConfiguration()
|
const config = new TestConfiguration()
|
||||||
let envCleanup: (() => void) | undefined
|
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
envCleanup = features.testutils.setFeatureFlags("*", {
|
|
||||||
SQS: method === "sql",
|
|
||||||
})
|
|
||||||
await config.beforeAll()
|
await config.beforeAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
envCleanup?.()
|
|
||||||
await config.afterAll()
|
await config.afterAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue