0.3.0 • Published 10 months ago

cdk-image-testing v0.3.0

Weekly downloads
-
License
-
Repository
github
Last release
10 months ago

cdk-image-testing

This is a simple tool to build container images in a CDK application for testing.

Setup

npm install --save-dev cdk-image-testing

Usage

import { ImageAssetTesting } from "cdk-image-testing"
import { spawnSync } from 'child_process'

// set jest timeout to 5 minutes
jest.setTimeout(5 * 60 * 1000)

describe('test-image-asset-build', () => {
  const app = new App();
  const stack = new Stack(app, 'test-stack');
  
  // Add construct with container image assets here.
  // This test assumes Dockerfile has a build target called "test".

  const assembly = app.synth()
  const imageAssets = new ImageAssetTesting(assembly.directory)

  test('pytest', async () => {
      const imageTags = await imageAssets.buildAll("test")

      for (let tag of imageTags) {
          const result = spawnSync('docker', ['run', '--network', 'host', tag], { stdio: 'inherit' });
          expect(result.status).toBe(0);
      }        
  })
})
0.3.0

10 months ago

0.2.4

10 months ago

0.2.3

11 months ago

0.2.2

11 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.1.0

11 months ago