chore(scaffolder): pull image first

This commit is contained in:
blam
2020-07-02 03:25:29 +02:00
parent dcf062f9bf
commit 165b206963
2 changed files with 15 additions and 0 deletions
@@ -26,6 +26,9 @@ describe('helpers', () => {
jest
.spyOn(mockDocker, 'run')
.mockResolvedValue([{ Error: null, StatusCode: 0 }]);
jest
.spyOn(mockDocker, 'pull')
.mockResolvedValue([{ Error: null, StatusCode: 0 }]);
});
describe('runDockerContainer', () => {
@@ -34,6 +37,17 @@ describe('helpers', () => {
const templateDir = os.tmpdir();
const resultDir = os.tmpdir();
it('will pull the docker container before running', async () => {
await runDockerContainer({
imageName,
args,
templateDir,
resultDir,
dockerClient: mockDocker,
});
expect(mockDocker.pull).toHaveBeenCalledWith(imageName, {});
});
it('should call the dockerClient run command with the correct arguments passed through', async () => {
await runDockerContainer({
imageName,
@@ -44,6 +44,7 @@ export const runDockerContainer = async ({
templateDir,
dockerClient,
}: RunDockerContainerOptions) => {
await dockerClient.pull(imageName, {});
const [{ Error: error, StatusCode: statusCode }] = await dockerClient.run(
imageName,
args,