-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(kubernetes): Add some tests on replaceAll (#4799)
* test(kubernetes): Convert kubernetes artifact tests to Java There aren't a lot of these, and it will be easier to add new ones (and easier to refactor and see at compile-time what tests use functions) if we convert them to Java. * test(kubernetes): Add some tests on replaceAll The functionality to replace artifacts in a manifest before deploying is fairly important but currently completely untested. Give it some good test coverage before making changes. * refactor(kubernetes): Minor simplifications to artifact replacer (1) There are a lot of small functions with unclear names that make the logic hard to follow; inline these where it makes the logic clearer. (2) The result of a document.read lets you iterate over the resulting nodes, and convert them to text. This is much clearer (and will perform better) than using an ObjectMapper for this. (3) The Artifact passed in to replaceIfPossible is always non-null, because it ultimately comes from the ImmutableCollection created by filterKubernetesArtifactsByNamespaceAndAccount. That function also filters out artifacts without a type set so we don't need to explicitly check again (though we'll still be safe and invert the .equals below because we can't really guarantee with an annotation that this particular artifact has a non-null type even though it effectively always does). * refactor(kubernetes): Move ArtifactProvider to clouddriver-kubernetes This is only implmented/used in the kubernetes provider, and it's not clear whether this is an abstraction useful to other providers. Let's move it to clouddriver-kubernetes. If this becomes something useful for other providers we can abstract common functionality to an interface in clouddriver-core at that point. We can probably just delete the interface as it has only one implementation, but keeping it for now. * style(tests): Add comment about manifest mutation in test
- Loading branch information
Showing
19 changed files
with
686 additions
and
414 deletions.
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
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
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
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
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
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
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
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
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
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
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
193 changes: 0 additions & 193 deletions
193
.../groovy/com/netflix/spinnaker/clouddriver/kubernetes/artifact/ArtifactReplacerSpec.groovy
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.