How to use dockest - 10 common examples

To help you get started, we’ve selected a few dockest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github erikengervall / dockest / packages / examples / aws-codebuild / src / integration-test / hello-world.spec.ts View on Github external
import http from 'http'
import fetch from 'node-fetch'
import { getHostAddress, getServiceAddress } from 'dockest/dist/test-helper'

const TARGET_HOST = getServiceAddress('aws_codebuild_website', 9000)

// hostname is either our docker container hostname or if not run inside a docker container the docker host
const HOSTNAME = getHostAddress()
const PORT = 8080

let server: http.Server

afterEach(async () => {
  if (server) {
    await new Promise((resolve, reject) => {
      server.close(err => {
        if (err) {
          reject(err)
          return
        }
        resolve()
      })
    })
  }
github erikengervall / dockest / packages / examples / aws-codebuild / src / integration-test / hello-world.spec.ts View on Github external
import http from 'http'
import fetch from 'node-fetch'
import { getHostAddress, getServiceAddress } from 'dockest/dist/test-helper'

const TARGET_HOST = getServiceAddress('aws_codebuild_website', 9000)

// hostname is either our docker container hostname or if not run inside a docker container the docker host
const HOSTNAME = getHostAddress()
const PORT = 8080

let server: http.Server

afterEach(async () => {
  if (server) {
    await new Promise((resolve, reject) => {
      server.close(err => {
        if (err) {
          reject(err)
          return
        }
        resolve()
github erikengervall / dockest / packages / examples / multiple-resources / dockest.ts View on Github external
import jest from 'jest'
import { Dockest, logLevel, defaultHealthchecks } from 'dockest'

const dockest = new Dockest({
  composeFile: 'docker-compose.yml',
  dumpErrors: true,
  exitHandler: errorPayload =>
    console.log(`\nHello <<${JSON.stringify(errorPayload, null, 2)}>>, nice to meet you 👋🏼\n`),
  jestLib: jest,
  jestOpts: { updateSnapshot: true },
  logLevel: logLevel.DEBUG,
  runInBand: true,
})

dockest.run([
  {
    serviceName: 'multiple_resources_postgres1sequelize',
    commands: [
      'sequelize db:migrate:undo:all',
      'sequelize db:migrate',
      'sequelize db:seed:undo:all',
      'sequelize db:seed --seed 20190101001337-demo-user',
    ],
    healthchecks: [defaultHealthchecks.postgres],
  },
  {
    serviceName: 'multiple_resources_postgres2knex',
github erikengervall / dockest / packages / examples / multiple-resources / dockest.ts View on Github external
import jest from 'jest'
import { Dockest, logLevel, defaultHealthchecks } from 'dockest'

const dockest = new Dockest({
  composeFile: 'docker-compose.yml',
  dumpErrors: true,
  exitHandler: errorPayload =>
    console.log(`\nHello <<${JSON.stringify(errorPayload, null, 2)}>>, nice to meet you 👋🏼\n`),
  jestLib: jest,
  jestOpts: { updateSnapshot: true },
  logLevel: logLevel.DEBUG,
  runInBand: true,
})

dockest.run([
  {
    serviceName: 'multiple_resources_postgres1sequelize',
    commands: [
      'sequelize db:migrate:undo:all',
      'sequelize db:migrate',
github erikengervall / dockest / packages / examples / multiple-compose-files / dockest.ts View on Github external
import { Dockest, logLevel, defaultHealthchecks } from 'dockest'

const dockest = new Dockest({
  composeFile: ['docker-compose-redis.yml', 'docker-compose-postgres.yml'],
  dumpErrors: true,
  logLevel: logLevel.DEBUG,
  runInBand: true,
})

dockest.run([
  {
    serviceName: 'multiple_compose_files_postgres',
    commands: [
      'sequelize db:migrate:undo:all',
      'sequelize db:migrate',
      'sequelize db:seed:undo:all',
      'sequelize db:seed --seed 20190101001337-demo-user',
    ],
    healthchecks: [defaultHealthchecks.postgres],
  },

  { serviceName: 'multiple_compose_files_redis' },
github erikengervall / dockest / packages / examples / compose-files-only / dockest.ts View on Github external
import Dockest, { logLevel } from 'dockest'

const dockest = new Dockest({
  jest: {
    verbose: true,
  },
  opts: {
    afterSetupSleep: 2,
    dumpErrors: true,
    logLevel: logLevel.DEBUG,
    guessRunnerType: true,
    composeFile: ['docker-compose-redis.yml', 'docker-compose-postgres.yml'],
  },
})

dockest.run()
github erikengervall / dockest / packages / examples / multiple-projects / dockest.ts View on Github external
import Dockest, { logLevel, runners } from 'dockest'

const dockest = new Dockest({
  jest: {
    lib: require('jest'),
    projects: ['./projects'],
  },
  opts: {
    logLevel: logLevel.DEBUG,
  },
})

const placeHolderRunner = new runners.GeneralPurposeRunner({
  service: 'never_gonna_give_you_up',
  image: 'redis:5.0.3',
  ports: [
    {
      published: 6382,
      target: 6379,
    },
  ],
})

dockest.attachRunners([placeHolderRunner])
github kafkajs / confluent-schema-registry / dockest.ts View on Github external
service: 'kafka',
  image: 'confluentinc/cp-kafka:5.2.2',
  dependsOn: [zooKeeperRunner],
  ports: {
    [KafkaRunner.DEFAULT_PORT_PLAINTEXT]: KafkaRunner.DEFAULT_PORT_PLAINTEXT,
  },
})

const dockest = new Dockest({
  runners: [kafkaRunner, schemaRegistryRunner],
  jest: {
    lib: require('jest'),
    verbose: true,
  },
  opts: {
    logLevel: logLevel.DEBUG,
    afterSetupSleep: 35,
    dev: {
      debug: process.argv[2] === 'debug' || process.argv[2] === 'dev',
    },
  },
})

dockest.run()
github erikengervall / dockest / packages / examples / aws-codebuild / src / dockest.ts View on Github external
import { Dockest, logLevel } from 'dockest'

const dockest = new Dockest({
  dumpErrors: true,
  logLevel: logLevel.DEBUG,
})

dockest.run([
  {
    serviceName: 'aws_codebuild_website',
  },
])
github erikengervall / dockest / packages / examples / inherit-from-compose-file / dockest.ts View on Github external
import Dockest, { runners, logLevel } from 'dockest'

const dockest = new Dockest({
  opts: {
    dumpErrors: true,
    logLevel: logLevel.DEBUG,
    composeFile: 'docker-compose.yml',
  },
})

dockest.attachRunners([
  new runners.PostgresRunner({
    service: 'postgres-service',
    database: 'postgres',
    password: 'postgres',
    username: 'postgres',
  }),
])

dockest.run()

dockest

Dockest is an integration testing tool aimed at alleviating the process of evaluating unit tests whilst running multi-container Docker applications.

MIT
Latest version published 10 months ago

Package Health Score

61 / 100
Full package analysis