You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2019/07/26 01:10:01 UTC

[camel-k] 01/02: chore(test): add some hooks to test staging artifacts

This is an automated email from the ASF dual-hosted git repository.

nferraro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit ca861f934bb6468373bbd3725e58c2a7d324215d
Author: nferraro <ni...@gmail.com>
AuthorDate: Fri Jul 26 02:55:43 2019 +0200

    chore(test): add some hooks to test staging artifacts
---
 e2e/test_staging_hooks.go | 35 +++++++++++++++++++++++++++++++++++
 e2e/test_support.go       |  6 ++++++
 2 files changed, 41 insertions(+)

diff --git a/e2e/test_staging_hooks.go b/e2e/test_staging_hooks.go
new file mode 100644
index 0000000..f85998b
--- /dev/null
+++ b/e2e/test_staging_hooks.go
@@ -0,0 +1,35 @@
+// +build integration knative
+
+// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
+
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package e2e
+
+func init() {
+	// this hook can be used to test a released version of the operator, e.g. the staging version during a voting period
+	// Uncomment the following lines and change references to enable the hook
+	kamelHooks = append(kamelHooks, func(cmd []string) []string {
+		//if len(cmd) > 0 && cmd[0] == "install" {
+		//	cmd = append(cmd, "--operator-image=docker.io/camelk/camel-k:1.0.0-M1")
+		//	cmd = append(cmd, "--maven-repository=https://repository.apache.org/content/repositories/orgapachecamel-1145")
+		//}
+		return cmd
+	})
+
+}
diff --git a/e2e/test_support.go b/e2e/test_support.go
index 5a0ca40..775d95e 100644
--- a/e2e/test_support.go
+++ b/e2e/test_support.go
@@ -51,6 +51,9 @@ import (
 var testContext context.Context
 var testClient client.Client
 
+// kamelHooks contains hooks useful to add option to kamel commands at runtime
+var kamelHooks []func([]string)[]string
+
 func init() {
 	var err error
 	testContext = context.TODO()
@@ -72,6 +75,9 @@ func kamel(args ...string) *cobra.Command {
 	if err != nil {
 		panic(err)
 	}
+	for _, hook := range kamelHooks {
+		args = hook(args)
+	}
 	c.SetArgs(args)
 	return c
 }