Improve flaky storybook test (#8515)

I don't think that will solve the flaky test but at least it will
cleanup the error message to avoid confusion
This commit is contained in:
Félix Malfait
2024-11-15 14:29:39 +01:00
committed by GitHub
parent bd18eb8b42
commit 34a3a66451
15 changed files with 341 additions and 131 deletions

View File

@ -56,9 +56,12 @@ rawDataSource
]; // See https://supabase.github.io/wrappers/
for (const wrapper of supabaseWrappers) {
if (await checkForeignDataWrapperExists(wrapper)) {
continue;
}
await performQuery(
`
CREATE FOREIGN DATA WRAPPER IF NOT EXISTS "${wrapper.toLowerCase()}_fdw"
CREATE FOREIGN DATA WRAPPER "${wrapper.toLowerCase()}_fdw"
HANDLER "${camelToSnakeCase(wrapper)}_fdw_handler"
VALIDATOR "${camelToSnakeCase(wrapper)}_fdw_validator";
`,
@ -71,3 +74,14 @@ rawDataSource
.catch((err) => {
console.error('Error during Data Source initialization:', err);
});
async function checkForeignDataWrapperExists(
wrapperName: string,
): Promise<boolean> {
const result = await rawDataSource.query(
`SELECT 1 FROM pg_foreign_data_wrapper WHERE fdwname = $1`,
[wrapperName],
);
return result.length > 0;
}