Skip to content

Commit

Permalink
singlestore custom integration tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodriguespn committed Sep 6, 2024
1 parent 3953409 commit f50336e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
38 changes: 19 additions & 19 deletions integration-tests/tests/singlestore/test-docker.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Docker from 'dockerode';
import getPort from 'get-port';
import { v4 as uuid } from 'uuid';
import mysql from 'mysql2/promise';
import * as mysql2 from 'mysql2/promise';
import path from 'path';
import { fileURLToPath } from 'url';
import { v4 as uuid } from 'uuid';
const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
const __dirname = path.dirname(__filename); // get the name of the directory

Expand All @@ -21,23 +21,23 @@ const image = 'ghcr.io/singlestore-labs/singlestoredb-dev:latest';
console.log('Pulling the SingleStoreDB Dev image...');
const pullStream = await docker.pull(image);
await new Promise((resolve, reject) =>
docker.modem.followProgress(pullStream, (err) => (err ? reject(err) : resolve(err)))
docker.modem.followProgress(pullStream, (err) => (err ? reject(err) : resolve(err)))
);
console.log('Image pulled successfully.');

console.log('Creating the SingleStoreDB container...');
singlestoreContainer = await docker.createContainer({
Image: image,
Env: ['ROOT_PASSWORD=singlestore'],
name: `drizzle-integration-tests-${uuid()}`,
HostConfig: {
AutoRemove: true,
PortBindings: {
'3306/tcp': [{ HostPort: `${port}` }],
'8080/tcp': [{ HostPort: '8080' }],
},
Binds: [`${initSqlPath}:/init.sql`],
},
Image: image,
Env: ['ROOT_PASSWORD=singlestore'],
name: `drizzle-integration-tests-${uuid()}`,
HostConfig: {
AutoRemove: true,
PortBindings: {
'3306/tcp': [{ HostPort: `${port}` }],
'8080/tcp': [{ HostPort: '8080' }],
},
Binds: [`${initSqlPath}:/init.sql`],
},
});
console.log('Container created successfully.');

Expand All @@ -47,11 +47,11 @@ await new Promise((resolve) => setTimeout(resolve, 4000));
console.log('Container started.');

console.log('Connecting to the database...');
const connection = await mysql.createConnection({
host: 'localhost',
port: port,
user: 'root',
password: 'singlestore',
const connection = await mysql2.createConnection({
host: 'localhost',
port: port,
user: 'root',
password: 'singlestore',
});
console.log('Database connection established.');

Expand Down
3 changes: 1 addition & 2 deletions integration-tests/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default defineConfig({
'tests/imports/**/*',
'tests/extensions/vectors/**/*',
'tests/version.test.ts',
'tests/singlestore/**/*.test.ts'
'tests/singlestore/**/singlestore-custom.test.ts',
],
exclude: [
...(process.env.SKIP_EXTERNAL_DB_TESTS
Expand All @@ -37,7 +37,6 @@ export default defineConfig({
// Have a strange "invalid SQL: ERROR: must be owner of schema public" error. Will need to check with xata team
'tests/pg/xata-http.test.ts',
'tests/pg/neon-http-batch.ts',
'tests/singlestore/singlestore-proxy.test.ts'
],
typecheck: {
tsconfig: 'tsconfig.json',
Expand Down

0 comments on commit f50336e

Please sign in to comment.