mirror of
https://github.com/actions/runner-container-hooks.git
synced 2025-12-13 16:16:46 +00:00
37 lines
923 B
TypeScript
37 lines
923 B
TypeScript
import { runContainerStep } from '../src/hooks'
|
|
import { TestHelper } from './test-setup'
|
|
|
|
jest.useRealTimers()
|
|
|
|
let testHelper: TestHelper
|
|
|
|
let runContainerStepData: any
|
|
|
|
describe('Run container step', () => {
|
|
beforeEach(async () => {
|
|
testHelper = new TestHelper()
|
|
await testHelper.initialize()
|
|
runContainerStepData = testHelper.getRunContainerStepDefinition()
|
|
})
|
|
|
|
afterEach(async () => {
|
|
await testHelper.cleanup()
|
|
})
|
|
|
|
it('should not throw', async () => {
|
|
const exitCode = await runContainerStep(runContainerStepData.args)
|
|
expect(exitCode).toBe(0)
|
|
})
|
|
|
|
it('should shold have env variables available', async () => {
|
|
runContainerStepData.args.entryPoint = 'bash'
|
|
runContainerStepData.args.entryPointArgs = [
|
|
'-c',
|
|
'if [[ -z $NODE_ENV ]]; then exit 1; fi'
|
|
]
|
|
await expect(
|
|
runContainerStep(runContainerStepData.args)
|
|
).resolves.not.toThrow()
|
|
})
|
|
})
|