Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ptpaterson committed Dec 30, 2024
1 parent 1a7e68c commit 3cab568
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/config/setup-test-container.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export function setupTestContainer() {
modem: {
followProgress: stub(),
},
ping: stub(),
pull: stub(),
}),
credentials: awilix.asClass(stub()).singleton(),
Expand Down
19 changes: 19 additions & 0 deletions test/local.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,25 @@ Please pass a --host-port other than '8443'.",
);
});

it("Fails start if Docker is not running.", async () => {
setupCreateContainerMocks();
docker.ping.onCall(0).rejects();
try {
await run("local --no-color", container);
} catch (_) {}
expect(docker.pull).not.to.have.been.called;
expect(docker.modem.followProgress).not.to.have.been.called;
expect(startStub).not.to.have.been.called;
expect(logsStub).not.to.have.been.called;
expect(docker.createContainer).not.to.have.been.called;
const written = stderrStream.getWritten();
expect(written).to.contain(
`[StartContainer] Docker service is not available. Make sure that Docker is running.`,
);
expect(written).not.to.contain("An unexpected");
expect(written).not.to.contain("fauna local"); // help text
});

it("Fails start with a prompt to contact Fauna if pull fails.", async () => {
setupCreateContainerMocks();
docker.pull.onCall(0).rejects(new Error("Remote repository not found"));
Expand Down

0 comments on commit 3cab568

Please sign in to comment.