This repository has been archived by the owner on Feb 16, 2024. It is now read-only.
forked from kudobuilder/kuttl
-
Notifications
You must be signed in to change notification settings - Fork 5
[Enhancement] Comprehensive support for asserting contents of lists/arrays #36
Closed
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
26a6ce8
assert-array
shubham-cmyk 3991f49
make default to be anywhere
shubham-cmyk cb78c41
fix test failure
shubham-cmyk 45940d2
fix the lint
shubham-cmyk d45a17b
refactor code
shubham-cmyk d4f5a4a
remove ns
shubham-cmyk 4270b78
fix changes
shubham-cmyk d78d228
remove name
shubham-cmyk 00602ad
fix lint
shubham-cmyk 6ee1cd9
fix names
shubham-cmyk 677df93
fix spec
shubham-cmyk 535c179
fix e2e
shubham-cmyk 0d22553
should fail
shubham-cmyk 3ce04f5
fix err handling
shubham-cmyk 9162533
fix few change
shubham-cmyk 7595bde
remove code
shubham-cmyk 9e36ef1
change scope of variable
shubham-cmyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,13 @@ const ( | |
MatchWildcard MatchType = "Wildcard" | ||
) | ||
|
||
type Strategy string | ||
|
||
const ( | ||
StrategyAnywhere Strategy = "Anywhere" | ||
StrategyExact Strategy = "Exact" | ||
) | ||
|
||
// Create embedded struct to implement custom DeepCopyInto method | ||
type RestConfig struct { | ||
RC *rest.Config | ||
|
@@ -133,7 +140,7 @@ type TestStep struct { | |
// Useful to reuse a number of applies across tests / test steps. | ||
// all relative paths are relative to the folder the TestStep is defined in. | ||
Apply []Apply `json:"apply,omitempty"` | ||
Assert []string `json:"assert,omitempty"` | ||
Assert []Assert `json:"assert,omitempty"` | ||
Error []string `json:"error,omitempty"` | ||
|
||
// Objects to delete at the beginning of the test step. | ||
|
@@ -152,6 +159,25 @@ type TestStep struct { | |
Kubeconfig string `json:"kubeconfig,omitempty"` | ||
} | ||
|
||
type Assert struct { | ||
// File specifies the relative or full path to the YAML containing the expected content. | ||
File string `json:"file"` | ||
ShouldFail bool `json:"shouldFail,omitempty"` | ||
Options *Options `json:"options,omitempty"` | ||
} | ||
Comment on lines
+162
to
+167
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need a custom |
||
|
||
type Options struct { | ||
AssertArray []AssertArray `json:"arrays,omitempty"` | ||
} | ||
|
||
// AssertArray specifies conditions for verifying content within a YAML against a Kubernetes resource. | ||
type AssertArray struct { | ||
// Path indicates the location within the YAML file to extract data for verification. | ||
Path string `json:"path"` | ||
// Strategy defines how the extracted data should be compared against the Kubernetes resource. | ||
Strategy Strategy `json:"strategy"` | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// TestAssert represents the settings needed to verify the result of a test step. | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't we need
ShouldFail
here