Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cmd/uptest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ var (
renderOnly = e2e.Flag("render-only", "Only render test files. Do not run the tests.").Default("false").Bool()
logCollectInterval = e2e.Flag("log-collect-interval", "Specifies the interval duration for collecting logs. "+
"The duration should be provided in a format understood by the tool, such as seconds (s), minutes (m), or hours (h). For example, '30s' for 30 seconds, '5m' for 5 minutes, or '1h' for one hour.").Default("30s").Duration()
skipUpdate = e2e.Flag("skip-update", "Skip the update step of the test.").Default("false").Bool()
skipImport = e2e.Flag("skip-import", "Skip the import step of the test.").Default("false").Bool()
useLibraryMode = e2e.Flag("use-library-mode", "Use library mode instead of CLI fork mode. When enabled, chainsaw and crossplane are used as Go libraries instead of external CLI commands.").Default("false").Bool()
skipUpdate = e2e.Flag("skip-update", "Skip the update step of the test.").Default("false").Bool()
skipImport = e2e.Flag("skip-import", "Skip the import step of the test.").Default("false").Bool()
skipWebhookCheck = e2e.Flag("skip-webhook-check", "Skip the webhook endpoint health check.").Default("false").Bool()
useLibraryMode = e2e.Flag("use-library-mode", "Use library mode instead of CLI fork mode. When enabled, chainsaw and crossplane are used as Go libraries instead of external CLI commands.").Default("false").Bool()
)

func main() {
Expand Down Expand Up @@ -102,6 +103,7 @@ func e2eTests() {
SetSkipDelete(*skipDelete).
SetSkipUpdate(*skipUpdate).
SetSkipImport(*skipImport).
SetSkipWebhookCheck(*skipWebhookCheck).
SetOnlyCleanUptestResources(*onlyCleanUptestResources).
SetRenderOnly(*renderOnly).
SetLogCollectionInterval(*logCollectInterval).
Expand Down
6 changes: 6 additions & 0 deletions internal/config/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ func (b *Builder) SetSkipImport(skipImport bool) *Builder {
return b
}

// SetSkipWebhookCheck sets whether the AutomatedTest should skip the webhook endpoint health check and returns the Builder.
func (b *Builder) SetSkipWebhookCheck(skipWebhookCheck bool) *Builder {
b.test.SkipWebhookCheck = skipWebhookCheck
return b
}

// SetOnlyCleanUptestResources sets whether the AutomatedTest should clean up only test-specific resources and returns the Builder.
func (b *Builder) SetOnlyCleanUptestResources(onlyCleanUptestResources bool) *Builder {
b.test.OnlyCleanUptestResources = onlyCleanUptestResources
Expand Down
8 changes: 5 additions & 3 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ type AutomatedTest struct {
DefaultTimeout time.Duration
DefaultConditions []string

SkipDelete bool
SkipUpdate bool
SkipImport bool
SkipDelete bool
SkipUpdate bool
SkipImport bool
SkipWebhookCheck bool

OnlyCleanUptestResources bool

Expand All @@ -79,6 +80,7 @@ type TestCase struct {
TeardownScriptPath string
SkipUpdate bool
SkipImport bool
SkipWebhookCheck bool

OnlyCleanUptestResources bool

Expand Down
2 changes: 2 additions & 0 deletions internal/templates/00-apply.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ spec:
- name: Apply Resources
description: Apply resources to the cluster.
try:
{{- if not .TestCase.SkipWebhookCheck }}
- script:
content: |
echo "Checking webhook health before proceeding..."
Expand All @@ -27,6 +28,7 @@ spec:
- sleep:
# Wait for conversion webhook endpoints to become fully operational after health check
duration: 10s
{{- end }}
- apply:
file: {{ .TestCase.TestDirectory }}
- script:
Expand Down
4 changes: 3 additions & 1 deletion internal/templates/02-import.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ spec:
else
echo "No provider DeploymentRuntimeConfigs found to scale up"
fi
curl -sL https://raw.githubusercontent.com/crossplane/uptest/main/hack/check_endpoints.sh -o /tmp/check_endpoints.sh && chmod +x /tmp/check_endpoints.sh
curl -sL https://raw.githubusercontent.com/crossplane/uptest/main/hack/patch.sh -o /tmp/patch.sh && chmod +x /tmp/patch.sh
curl -sL https://raw.githubusercontent.com/crossplane/uptest/main/hack/patch-ns.sh -o /tmp/patch-ns.sh && chmod +x /tmp/patch-ns.sh
{{- if not .TestCase.SkipWebhookCheck }}
curl -sL https://raw.githubusercontent.com/crossplane/uptest/main/hack/check_endpoints.sh -o /tmp/check_endpoints.sh && chmod +x /tmp/check_endpoints.sh
/tmp/check_endpoints.sh
sleep 10
{{- end }}
{{- range $resource := .Resources }}
{{- if eq $resource.KindGroup "secret." -}}
{{continue}}
Expand Down
Loading
Loading