PR comment.
This commit is contained in:
parent
b68697002a
commit
ea7dffa3d7
|
@ -6,12 +6,8 @@ dotenv.config({
|
||||||
path,
|
path,
|
||||||
})
|
})
|
||||||
|
|
||||||
export function getImageSHAs() {
|
export const MSSQL_IMAGE = `mcr.microsoft.com/mssql/server@${process.env.MSSQL_SHA}`
|
||||||
return {
|
export const MYSQL_IMAGE = `mysql@${process.env.MYSQL_SHA}`
|
||||||
mssql: `mcr.microsoft.com/mssql/server@${process.env.MSSQL_SHA}`,
|
export const POSTGRES_IMAGE = `postgres@${process.env.POSTGRES_SHA}`
|
||||||
mysql: `mysql@${process.env.MYSQL_SHA}`,
|
export const MONGODB_IMAGE = `mongo@${process.env.MONGODB_SHA}`
|
||||||
postgres: `postgres@${process.env.POSTGRES_SHA}`,
|
export const MARIADB_IMAGE = `mariadb@${process.env.MARIADB_SHA}`
|
||||||
mongodb: `mongo@${process.env.MONGODB_SHA}`,
|
|
||||||
mariadb: `mariadb@${process.env.MARIADB_SHA}`,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { AbstractWaitStrategy } from "testcontainers/build/wait-strategies/wait-
|
||||||
import { generator, testContainerUtils } from "@budibase/backend-core/tests"
|
import { generator, testContainerUtils } from "@budibase/backend-core/tests"
|
||||||
import { startContainer } from "."
|
import { startContainer } from "."
|
||||||
import { knexClient } from "./mysql"
|
import { knexClient } from "./mysql"
|
||||||
import { getImageSHAs } from "./images"
|
import { MARIADB_IMAGE } from "./images"
|
||||||
|
|
||||||
let ports: Promise<testContainerUtils.Port[]>
|
let ports: Promise<testContainerUtils.Port[]>
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class MariaDBWaitStrategy extends AbstractWaitStrategy {
|
||||||
export async function getDatasource(): Promise<Datasource> {
|
export async function getDatasource(): Promise<Datasource> {
|
||||||
if (!ports) {
|
if (!ports) {
|
||||||
ports = startContainer(
|
ports = startContainer(
|
||||||
new GenericContainer(getImageSHAs().mariadb)
|
new GenericContainer(MARIADB_IMAGE)
|
||||||
.withExposedPorts(3306)
|
.withExposedPorts(3306)
|
||||||
.withEnvironment({ MARIADB_ROOT_PASSWORD: "password" })
|
.withEnvironment({ MARIADB_ROOT_PASSWORD: "password" })
|
||||||
.withWaitStrategy(new MariaDBWaitStrategy())
|
.withWaitStrategy(new MariaDBWaitStrategy())
|
||||||
|
|
|
@ -2,14 +2,14 @@ import { generator, testContainerUtils } from "@budibase/backend-core/tests"
|
||||||
import { Datasource, SourceName } from "@budibase/types"
|
import { Datasource, SourceName } from "@budibase/types"
|
||||||
import { GenericContainer, Wait } from "testcontainers"
|
import { GenericContainer, Wait } from "testcontainers"
|
||||||
import { startContainer } from "."
|
import { startContainer } from "."
|
||||||
import { getImageSHAs } from "./images"
|
import { MONGODB_IMAGE } from "./images"
|
||||||
|
|
||||||
let ports: Promise<testContainerUtils.Port[]>
|
let ports: Promise<testContainerUtils.Port[]>
|
||||||
|
|
||||||
export async function getDatasource(): Promise<Datasource> {
|
export async function getDatasource(): Promise<Datasource> {
|
||||||
if (!ports) {
|
if (!ports) {
|
||||||
ports = startContainer(
|
ports = startContainer(
|
||||||
new GenericContainer(getImageSHAs().mongodb)
|
new GenericContainer(MONGODB_IMAGE)
|
||||||
.withExposedPorts(27017)
|
.withExposedPorts(27017)
|
||||||
.withEnvironment({
|
.withEnvironment({
|
||||||
MONGO_INITDB_ROOT_USERNAME: "mongo",
|
MONGO_INITDB_ROOT_USERNAME: "mongo",
|
||||||
|
|
|
@ -3,14 +3,14 @@ import { GenericContainer, Wait } from "testcontainers"
|
||||||
import { generator, testContainerUtils } from "@budibase/backend-core/tests"
|
import { generator, testContainerUtils } from "@budibase/backend-core/tests"
|
||||||
import { startContainer } from "."
|
import { startContainer } from "."
|
||||||
import knex from "knex"
|
import knex from "knex"
|
||||||
import { getImageSHAs } from "./images"
|
import { MSSQL_IMAGE } from "./images"
|
||||||
|
|
||||||
let ports: Promise<testContainerUtils.Port[]>
|
let ports: Promise<testContainerUtils.Port[]>
|
||||||
|
|
||||||
export async function getDatasource(): Promise<Datasource> {
|
export async function getDatasource(): Promise<Datasource> {
|
||||||
if (!ports) {
|
if (!ports) {
|
||||||
ports = startContainer(
|
ports = startContainer(
|
||||||
new GenericContainer(getImageSHAs().mssql)
|
new GenericContainer(MSSQL_IMAGE)
|
||||||
.withExposedPorts(1433)
|
.withExposedPorts(1433)
|
||||||
.withEnvironment({
|
.withEnvironment({
|
||||||
ACCEPT_EULA: "Y",
|
ACCEPT_EULA: "Y",
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { AbstractWaitStrategy } from "testcontainers/build/wait-strategies/wait-
|
||||||
import { generator, testContainerUtils } from "@budibase/backend-core/tests"
|
import { generator, testContainerUtils } from "@budibase/backend-core/tests"
|
||||||
import { startContainer } from "."
|
import { startContainer } from "."
|
||||||
import knex from "knex"
|
import knex from "knex"
|
||||||
import { getImageSHAs } from "./images"
|
import { MYSQL_IMAGE } from "./images"
|
||||||
|
|
||||||
let ports: Promise<testContainerUtils.Port[]>
|
let ports: Promise<testContainerUtils.Port[]>
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class MySQLWaitStrategy extends AbstractWaitStrategy {
|
||||||
export async function getDatasource(): Promise<Datasource> {
|
export async function getDatasource(): Promise<Datasource> {
|
||||||
if (!ports) {
|
if (!ports) {
|
||||||
ports = startContainer(
|
ports = startContainer(
|
||||||
new GenericContainer(getImageSHAs().mysql)
|
new GenericContainer(MYSQL_IMAGE)
|
||||||
.withExposedPorts(3306)
|
.withExposedPorts(3306)
|
||||||
.withEnvironment({ MYSQL_ROOT_PASSWORD: "password" })
|
.withEnvironment({ MYSQL_ROOT_PASSWORD: "password" })
|
||||||
.withWaitStrategy(new MySQLWaitStrategy().withStartupTimeout(10000))
|
.withWaitStrategy(new MySQLWaitStrategy().withStartupTimeout(10000))
|
||||||
|
|
|
@ -3,14 +3,14 @@ import { GenericContainer, Wait } from "testcontainers"
|
||||||
import { generator, testContainerUtils } from "@budibase/backend-core/tests"
|
import { generator, testContainerUtils } from "@budibase/backend-core/tests"
|
||||||
import { startContainer } from "."
|
import { startContainer } from "."
|
||||||
import knex from "knex"
|
import knex from "knex"
|
||||||
import { getImageSHAs } from "./images"
|
import { POSTGRES_IMAGE } from "./images"
|
||||||
|
|
||||||
let ports: Promise<testContainerUtils.Port[]>
|
let ports: Promise<testContainerUtils.Port[]>
|
||||||
|
|
||||||
export async function getDatasource(): Promise<Datasource> {
|
export async function getDatasource(): Promise<Datasource> {
|
||||||
if (!ports) {
|
if (!ports) {
|
||||||
ports = startContainer(
|
ports = startContainer(
|
||||||
new GenericContainer(getImageSHAs().postgres)
|
new GenericContainer(POSTGRES_IMAGE)
|
||||||
.withExposedPorts(5432)
|
.withExposedPorts(5432)
|
||||||
.withEnvironment({ POSTGRES_PASSWORD: "password" })
|
.withEnvironment({ POSTGRES_PASSWORD: "password" })
|
||||||
.withWaitStrategy(
|
.withWaitStrategy(
|
||||||
|
|
Loading…
Reference in New Issue