mirror of
https://github.com/actions/runner-container-hooks.git
synced 2025-12-18 10:46:43 +00:00
extracted creating a registry to test, written basic test expecting not to throw an exception
This commit is contained in:
@@ -3,11 +3,10 @@ import { TestHelper } from './test-setup'
|
||||
|
||||
jest.useRealTimers()
|
||||
|
||||
let testHelper: TestHelper
|
||||
describe('Run container step with image', () => {
|
||||
let testHelper: TestHelper
|
||||
let runContainerStepData: any
|
||||
|
||||
let runContainerStepData: any
|
||||
|
||||
describe('Run container step', () => {
|
||||
beforeEach(async () => {
|
||||
testHelper = new TestHelper()
|
||||
await testHelper.initialize()
|
||||
@@ -39,3 +38,33 @@ describe('Run container step', () => {
|
||||
).resolves.not.toThrow()
|
||||
})
|
||||
})
|
||||
|
||||
describe('run container step with docker build', () => {
|
||||
let testHelper: TestHelper
|
||||
let runContainerStepData: any
|
||||
beforeEach(async () => {
|
||||
testHelper = new TestHelper()
|
||||
await testHelper.initialize()
|
||||
runContainerStepData = testHelper.getRunContainerStepDefinition()
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await testHelper.cleanup()
|
||||
})
|
||||
|
||||
it('should build container and execute docker action', async () => {
|
||||
const { registryName, registryPort, nodePort } =
|
||||
await testHelper.createContainerRegistry()
|
||||
|
||||
// process.env.RUNNER_CONTAINER_HOOKS_REGISTRY_HOST = 'docker-registry'
|
||||
// process.env.RUNNER_CONTAINER_HOOKS_REGISTRY_PORT = '5000'
|
||||
// process.env.RUNNER_CONTAINER_HOOKS_REGISTRY_NODE_PORT = '31500'
|
||||
process.env.RUNNER_CONTAINER_HOOKS_REGISTRY_HOST = registryName
|
||||
process.env.RUNNER_CONTAINER_HOOKS_REGISTRY_PORT = registryPort.toString()
|
||||
process.env.RUNNER_CONTAINER_HOOKS_REGISTRY_NODE_PORT = nodePort.toString()
|
||||
const actionPath = testHelper.initializeDockerAction()
|
||||
const data = JSON.parse(JSON.stringify(runContainerStepData))
|
||||
data.args.dockerfile = `${actionPath}/Dockerfile`
|
||||
await expect(runContainerStep(data.args)).resolves.not.toThrow()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user