-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(k8s): support immutable build success
- Loading branch information
Showing
2 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
garden-service/test/unit/src/plugins/kubernetes/container/build.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright (C) 2018-2020 Garden Technologies, Inc. <[email protected]> | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
import { kanikoBuildFailed } from "../../../../../../src/plugins/kubernetes/container/build" | ||
import { expect } from "chai" | ||
|
||
describe("kaniko build", () => { | ||
it("should return as successful when immutable tag already exists in destination", () => { | ||
const errorMessage = `error pushing image: failed to push to destination dockerhub.com/garden/backend:v-1234567: TAG_INVALID: The image tag 'v-1234567' already exists in the 'garden/backend' repository and cannot be overwritten because the repository is immutable.` | ||
|
||
expect( | ||
kanikoBuildFailed({ | ||
moduleName: "foo", | ||
command: [], | ||
version: "", | ||
startedAt: new Date(), | ||
completedAt: new Date(), | ||
success: false, | ||
log: errorMessage, | ||
}) | ||
).to.be.false | ||
}) | ||
|
||
it("should return as failure when other error messages are present", () => { | ||
const errorMessage = "error pushing" | ||
|
||
expect( | ||
kanikoBuildFailed({ | ||
moduleName: "foo", | ||
command: [], | ||
version: "", | ||
startedAt: new Date(), | ||
completedAt: new Date(), | ||
success: false, | ||
log: errorMessage, | ||
}) | ||
).to.be.true | ||
}) | ||
|
||
it("should return as success when the build succeeded", () => { | ||
expect( | ||
kanikoBuildFailed({ | ||
moduleName: "foo", | ||
command: [], | ||
version: "", | ||
startedAt: new Date(), | ||
completedAt: new Date(), | ||
success: true, | ||
log: "", | ||
}) | ||
).to.be.false | ||
}) | ||
}) |