From 8ecf3525fae497e07c219a3a1e20b995685e336e Mon Sep 17 00:00:00 2001 From: Andrea Tarocchi Date: Thu, 12 Oct 2023 12:20:37 +0200 Subject: [PATCH 1/3] Added build-catalog-tool-timeout parameter to install command. Added CAMEL_K_BUILD_CATALOG_TOOL_TIMEOUT to e2e tests to leverage the new install parameter. Updated doc. --- .gitignore | 2 ++ docs/modules/ROOT/pages/contributing/e2e.adoc | 13 ++++++++++--- .../ROOT/pages/installation/advanced/advanced.adoc | 3 ++- e2e/support/test_support.go | 6 ++++++ pkg/cmd/install.go | 12 ++++++++++++ pkg/cmd/install_test.go | 7 +++++++ 6 files changed, 39 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 46a333c088..aebef3db0d 100644 --- a/.gitignore +++ b/.gitignore @@ -182,3 +182,5 @@ pkg/resources/resources.go # MAC OS files .DS_Store +# Audit logs file +logs.txt diff --git a/docs/modules/ROOT/pages/contributing/e2e.adoc b/docs/modules/ROOT/pages/contributing/e2e.adoc index 337f0ab86a..02d35e3166 100644 --- a/docs/modules/ROOT/pages/contributing/e2e.adoc +++ b/docs/modules/ROOT/pages/contributing/e2e.adoc @@ -31,15 +31,22 @@ This is the list of the groups we are using (please, notice that they can slight * builder (`make test-builder`) * common (`make test-common`) * commonwithcustominstall (`make test-common-with-custom-install`) - * install (`make test-install` and `make test-install-olm`) + * install (`make test-install`, `make test-install-olm` and `test-install-upgrade`) * knative (`make test-knative`) * native (`make test-quarkus-native` and `make test-quarkus-native-high-memory`) * telemetry (`make test-telemetry`) - * yaks (run only in CI) Each group tests a specific feature of Camel K. Typically any new test should be falling under the `common` group, unless it belongs to any other category or it requires some particular customization. As an example, `telemetry` requires the configuration of an OTLP Collector, reason why it requires its own group. If the test still is a common one but needs to perform customization on the Camel K Operator, then, it should be developed under `commonwithcustominstall`: as an example, we have there tests which requires the configuration of a Maven proxy. -It's important to know that `common` is used as smoke test in the nightly release process. We want to keep this group of test as fast as possible. +It's important to know that a subset of `common` named `test-smoke` is used as smoke test in the nightly release process. We want to keep this group of test as fast as possible. + +=== Configure End To End tests runs with env vars +Some e2e test runs parameters can be configured usually with env vars. +Most of them are located at https://github.com/apache/camel-k/tree/main/e2e/support/test_support.go[e2e/support/test_support.go] in `init` and `kamelInstallWithContext` functions. +A list of the most commonly used: + + * `CAMEL_K_TEST_SKIP_PROBLEMATIC`: set it to `true` to skip tests that might fail. + * `CAMEL_K_BUILD_CATALOG_TOOL_TIMEOUT`: set timeout time (in seconds) for building the catalog tool image is the default 2 minutes are not enough for your setup. [[testing-operator]] == Testing Operator under development diff --git a/docs/modules/ROOT/pages/installation/advanced/advanced.adoc b/docs/modules/ROOT/pages/installation/advanced/advanced.adoc index c727746a8b..ce2f342a65 100644 --- a/docs/modules/ROOT/pages/installation/advanced/advanced.adoc +++ b/docs/modules/ROOT/pages/installation/advanced/advanced.adoc @@ -45,6 +45,7 @@ We have several configuration used to influence the building of an integration: --build-strategy string Set the build strategy --build-order-strategy string Set the build order strategy --build-timeout string Set how long the build process can last +--"build-catalog-tool-timeout string Set how long the catalogtool image build can last --max-running-pipelines int Maximum number of parallel running pipelines ``` A very important set of configuration you can provide is related to Maven: @@ -122,4 +123,4 @@ OLM is one of the methodology and we have a few handy parameters to customize it --olm-starting-csv string Allow to install a specific version from the operator source instead of latest available from the channel ``` -Have a look at xref:installation/installation.adoc#olm[OLM installation procedure]. \ No newline at end of file +Have a look at xref:installation/installation.adoc#olm[OLM installation procedure]. diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go index bbb10228fd..66e5e573f8 100644 --- a/e2e/support/test_support.go +++ b/e2e/support/test_support.go @@ -293,6 +293,12 @@ func kamelInstallWithContext(ctx context.Context, operatorID string, namespace s installArgs = append(installArgs, "--operator-image-pull-policy", opImagePullPolicy) } + opBuildCatalogToolTimeout := os.Getenv("CAMEL_K_BUILD_CATALOG_TOOL_TIMEOUT") + if opImagePullPolicy != "" { + fmt.Printf("Setting build catalog tool timeout to %s\n", opBuildCatalogToolTimeout) + installArgs = append(installArgs, "--build-catalog-tool-timeout", opBuildCatalogToolTimeout) + } + installArgs = append(installArgs, args...) return KamelWithContext(ctx, installArgs...) } diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go index 7c55ea4095..c5e8a59d74 100644 --- a/pkg/cmd/install.go +++ b/pkg/cmd/install.go @@ -111,6 +111,7 @@ func newCmdInstall(rootCmdOptions *RootCmdOptions) (*cobra.Command, *installCmdO cmd.Flags().String("build-publish-strategy", "", "Set the build publish strategy") cmd.Flags().StringArray("build-publish-strategy-option", nil, "Add a build publish strategy option, as ") cmd.Flags().String("build-timeout", "", "Set how long the build process can last") + cmd.Flags().String("build-catalog-tool-timeout", "", "Set how long the catalogtool image build can last") cmd.Flags().String("trait-profile", "", "The profile to use for traits") // OLM @@ -186,6 +187,7 @@ type installCmdOptions struct { BuildPublishStrategy string `mapstructure:"build-publish-strategy"` BuildPublishStrategyOptions []string `mapstructure:"build-publish-strategy-options"` BuildTimeout string `mapstructure:"build-timeout"` + BuildCatalogToolTimeout string `mapstructure:"build-catalog-tool-timeout"` MavenExtensions []string `mapstructure:"maven-extensions"` MavenLocalRepository string `mapstructure:"maven-local-repository"` MavenProperties []string `mapstructure:"maven-properties"` @@ -542,6 +544,16 @@ func (o *installCmdOptions) setupIntegrationPlatform(c client.Client, namespace Duration: d, } } + if o.BuildCatalogToolTimeout != "" { + d, err := time.ParseDuration(o.BuildCatalogToolTimeout) + if err != nil { + return nil, err + } + + platform.Spec.Build.BuildCatalogToolTimeout = &metav1.Duration{ + Duration: d, + } + } if o.MaxRunningBuilds > 0 { platform.Spec.Build.MaxRunningBuilds = o.MaxRunningBuilds } diff --git a/pkg/cmd/install_test.go b/pkg/cmd/install_test.go index ad222ab263..fa685319f3 100644 --- a/pkg/cmd/install_test.go +++ b/pkg/cmd/install_test.go @@ -121,6 +121,13 @@ func TestInstallBuildTimeoutFlag(t *testing.T) { assert.Equal(t, "10", installCmdOptions.BuildTimeout) } +func TestInstallBuildCatalogToolTimeoutFlag(t *testing.T) { + installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t) + _, err := test.ExecuteCommand(rootCmd, cmdInstall, "--build-catalog-tool-timeout", "600") + assert.Nil(t, err) + assert.Equal(t, "600", installCmdOptions.BuildCatalogToolTimeout) +} + func TestInstallClusterSetupFlag(t *testing.T) { installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t) _, err := test.ExecuteCommand(rootCmd, cmdInstall, "--cluster-setup") From 415a05d00fc435e64143ae9881829d0bc1ff0e1e Mon Sep 17 00:00:00 2001 From: Andrea Tarocchi Date: Fri, 13 Oct 2023 12:18:04 +0200 Subject: [PATCH 2/3] Update docs/modules/ROOT/pages/installation/advanced/advanced.adoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Gaëlle Fournier --- docs/modules/ROOT/pages/installation/advanced/advanced.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/modules/ROOT/pages/installation/advanced/advanced.adoc b/docs/modules/ROOT/pages/installation/advanced/advanced.adoc index ce2f342a65..39b1ccbc39 100644 --- a/docs/modules/ROOT/pages/installation/advanced/advanced.adoc +++ b/docs/modules/ROOT/pages/installation/advanced/advanced.adoc @@ -45,7 +45,7 @@ We have several configuration used to influence the building of an integration: --build-strategy string Set the build strategy --build-order-strategy string Set the build order strategy --build-timeout string Set how long the build process can last ---"build-catalog-tool-timeout string Set how long the catalogtool image build can last +--build-catalog-tool-timeout string Set how long the catalogtool image build can last --max-running-pipelines int Maximum number of parallel running pipelines ``` A very important set of configuration you can provide is related to Maven: From 554c8744dac307c1a6166173fca82ad8932b16a1 Mon Sep 17 00:00:00 2001 From: Andrea Tarocchi Date: Fri, 13 Oct 2023 12:18:13 +0200 Subject: [PATCH 3/3] Update docs/modules/ROOT/pages/contributing/e2e.adoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Gaëlle Fournier --- docs/modules/ROOT/pages/contributing/e2e.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/modules/ROOT/pages/contributing/e2e.adoc b/docs/modules/ROOT/pages/contributing/e2e.adoc index 02d35e3166..5fb7d72320 100644 --- a/docs/modules/ROOT/pages/contributing/e2e.adoc +++ b/docs/modules/ROOT/pages/contributing/e2e.adoc @@ -31,7 +31,7 @@ This is the list of the groups we are using (please, notice that they can slight * builder (`make test-builder`) * common (`make test-common`) * commonwithcustominstall (`make test-common-with-custom-install`) - * install (`make test-install`, `make test-install-olm` and `test-install-upgrade`) + * install (`make test-install`, `make test-install-olm` and `make test-install-upgrade`) * knative (`make test-knative`) * native (`make test-quarkus-native` and `make test-quarkus-native-high-memory`) * telemetry (`make test-telemetry`)