Skip to content

Commit

Permalink
fix(tests): Fix tests failing on artifact (#630)
Browse files Browse the repository at this point in the history
* fix(tests): Fix tests failing on artifact

An upcoming kork bump is making artifact null-safe by setting
fields to empty string. Fix the couple of places that expected
null.

* fix(tests): Bump kork as part of this commit

The test fix and bump need to happen at the same time.

Also fix an un-necessary mocking of Artifact.
  • Loading branch information
ezimanyi committed May 29, 2020
1 parent 44a09cb commit eff6d80
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
korkVersion=7.42.13
korkVersion=7.43.0
org.gradle.parallel=true
spinnakerGradleVersion=8.1.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ class CloudProviderBakeHandlerSpec extends Specification implements TestDefaults

where:
bakeRequest | bakeRecipe | expectedName | expectedVersion | expectedReference | expectedMetadata
null | null | null | null | SOME_AMI_ID | ["build_info_url": null, "build_number": null]
null | SOME_BAKE_RECIPE | SOME_BAKE_RECIPE_NAME | null | SOME_AMI_ID | ["build_info_url": null, "build_number": null]
SOME_BAKE_REQUEST | SOME_BAKE_RECIPE | SOME_BAKE_RECIPE_NAME | null | SOME_AMI_ID | ["build_info_url": SOME_BUILD_INFO_URL, "build_number": SOME_BUILD_NR]
null | null | "" | "" | SOME_AMI_ID | ["build_info_url": null, "build_number": null]
null | SOME_BAKE_RECIPE | SOME_BAKE_RECIPE_NAME | "" | SOME_AMI_ID | ["build_info_url": null, "build_number": null]
SOME_BAKE_REQUEST | SOME_BAKE_RECIPE | SOME_BAKE_RECIPE_NAME | "" | SOME_AMI_ID | ["build_info_url": SOME_BUILD_INFO_URL, "build_number": SOME_BUILD_NR]

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private static Path validateArchiveEntry(String archiveEntryName, Path outputPat

protected void downloadArtifactToTmpFileStructure(
BakeManifestEnvironment env, Artifact artifact, String referenceBaseURL) throws IOException {
if (artifact.getReference() == null) {
if (artifact.getReference() == null || artifact.getReference().isEmpty()) {
throw new InvalidRequestException("Input artifact has an empty 'reference' field.");
}
Path artifactFileName = Paths.get(extractArtifactName(artifact, referenceBaseURL));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class HelmTemplateUtilsSpec extends Specification {
def helmProperties = Mock(RoscoHelmConfigurationProperties)
def helmTemplateUtils = new HelmTemplateUtils(artifactDownloader, helmProperties)
def request = new HelmBakeManifestRequest()
def artifact = Mock(Artifact)
def artifact = Artifact.builder().build()
request.inputArtifacts = [artifact]
request.namespace = "default"
request.overrides = [:]
Expand Down

0 comments on commit eff6d80

Please sign in to comment.