[GitHub] nicolaferraro closed pull request #63: Fix tests and add release scripts up to cross-compilation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] nicolaferraro closed pull request #63: Fix tests and add release scripts up to cross-compilation

GitBox
nicolaferraro closed pull request #63:  Fix tests and add release scripts up to cross-compilation
URL: https://github.com/apache/camel-k/pull/63
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.gitignore b/.gitignore
index 2304de0..00e62a3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,12 @@
 /camel-k-operator
 /kamel
 
+# Released Packages
+*.tar.gz
+
+# Unuseful file
+/deploy/operator.yaml
+
 # We do not stage vendor directory
 /vendor
 
diff --git a/README.md b/README.md
index b7d7f4c..77ec083 100644
--- a/README.md
+++ b/README.md
@@ -111,6 +111,7 @@ This is a high level overview of the project structure:
 - [/deploy](/deploy): contains Kubernetes resource files that are used by the **kamel** client during installation. The `/deploy/resources.go` file is kept in sync with the content of the directory (`make build-embed-resources`), so that resources can be used from within the go code.
 - [/pkg](/pkg): this is where the code resides. The code is divided in multiple subpackages.
 - [/runtime](/runtime): the Java runtime code that is used inside the integration Docker containers.
+- [/test](/test): include integration tests to ensure that the software interacts correctly with Kubernetes and Openshift.
 - [/tmp](/tmp): scripts and Docker configuration files used by the operator-sdk.
 - [/vendor](/vendor): project dependencies.
 - [/version](/version): contains the global version of the project.
@@ -151,6 +152,7 @@ Unit tests are executed automatically as part of the build. They use the standar
 Integration tests (aimed at ensuring that the code integrates correctly with Kubernetes and Openshift), need special care.
 
 The **convention** used in this repo is to name unit tests `xxx_test.go`, and name integration tests `yyy_integration_test.go`.
+Integration tests are all in the [/test](/test) dir.
 
 Since both names end with `_test.go`, both would be executed by go during build, so you need to put a special **build tag** to mark
 integration tests. A integration test should start with the following line:
diff --git a/build/Makefile b/build/Makefile
index 74716be..335b9c0 100644
--- a/build/Makefile
+++ b/build/Makefile
@@ -1,6 +1,6 @@
 VERSION := $(shell ./build/get_version.sh)
 
-build: build-runtime build-operator build-kamel
+build: build-runtime build-operator build-kamel test
 
 build-operator: build-embed-resources
  go build -o camel-k-operator ./cmd/camel-k-operator/*.go
@@ -14,6 +14,14 @@ build-embed-resources:
 build-runtime:
  mvn clean install -f ./runtime/pom.xml
 
+release: prepare-release build images-build images-push test-integration cross-compile
+
+prepare-release:
+ ./build/prepare_release.sh
+
+cross-compile:
+ ./build/cross_compile.sh
+
 dep:
  dep ensure -v
 
@@ -43,22 +51,9 @@ check:
  go test ./...
 
 test-integration: check-integration
-check-integration: require-kubeconfig require-namespace
+check-integration:
  go test ./... -tags=integration
 
-ifndef WATCH_NAMESPACE
-require-namespace:
- $(error WATCH_NAMESPACE not set)
-else
-require-namespace:
- @echo "WATCH_NAMESPACE set"
-endif
-ifndef KUBERNETES_CONFIG
-require-kubeconfig:
- $(error KUBERNETES_CONFIG not set)
-else
-require-kubeconfig:
- @echo "KUBERNETES_CONFIG set"
-endif
-
-.PHONY: build build-operator build-kamel build-embed-resources build-runtime dep codegen images images-build images-push test check test-integration check-integration clean
+
+
+.PHONY: build build-operator build-kamel build-embed-resources build-runtime dep codegen images images-build images-push test check test-integration check-integration clean release prepare-release cross-compile
diff --git a/build/cross_compile.sh b/build/cross_compile.sh
new file mode 100755
index 0000000..b05a668
--- /dev/null
+++ b/build/cross_compile.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+location=$(dirname $0)
+builddir=$(realpath $location/../xtmp)
+
+rm -rf $builddir
+
+basename=camel-k-client
+version=$($location/get_version.sh)
+
+cross_compile () {
+ label=$1
+ export GOOS=$2
+ export GOARCH=$3
+
+ targetdir=$builddir/$label
+ go build -o $targetdir/kamel ./cmd/kamel/...
+
+ cp $location/../LICENSE $targetdir/
+ cp $location/../NOTICE $targetdir/
+
+ pushd . && cd $targetdir && tar -zcvf ../../$label.tar.gz . && popd
+}
+
+cross_compile $basename-$version-linux-64bit linux amd64
+cross_compile $basename-$version-mac-64bit darwin amd64
+cross_compile $basename-$version-windows-64bit windows amd64
+
+
+rm -rf $builddir
diff --git a/build/embed_resources.sh b/build/embed_resources.sh
index 7d7fe89..ab44706 100755
--- a/build/embed_resources.sh
+++ b/build/embed_resources.sh
@@ -38,7 +38,7 @@ func init() {
 
 EOM
 
-for f in $(ls $destdir | grep ".yaml"); do
+for f in $(ls $destdir | grep ".yaml" | grep -v -e "^operator.yaml$"); do
  printf "\tResources[\"$f\"] =\n\t\t\`\n" >> $destfile
  cat $destdir/$f >> $destfile
  printf "\n\`\n" >> $destfile
diff --git a/build/prepare_release.sh b/build/prepare_release.sh
new file mode 100755
index 0000000..cd8894c
--- /dev/null
+++ b/build/prepare_release.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+location=$(dirname $0)
+global_version_file=$location/../version/version.go
+
+# Set the new global version by removing "-SNAPSHOT"
+sed -i "s/-SNAPSHOT//g" $global_version_file
+
+# Get the new version
+version=$($location/get_version.sh)
+
+# Updating the Java modules
+mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$version -f $location/../runtime
+
+echo "Camel K prepared for releasing version: $version"
+
diff --git a/deploy/operator.yaml b/deploy/operator.yaml
deleted file mode 100644
index 863b21c..0000000
--- a/deploy/operator.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
-apiVersion: apps/v1
-kind: Deployment
-metadata:
-  name: camel-k-operator
-spec:
-  replicas: 1
-  selector:
-    matchLabels:
-      name: camel-k-operator
-  template:
-    metadata:
-      labels:
-        name: camel-k-operator
-    spec:
-      containers:
-        - name: camel-k-operator
-          image: docker.io/apache/camel-k:0.0.1-SNAPSHOT
-          ports:
-          - containerPort: 60000
-            name: metrics
-          command:
-          - camel-k-operator
-          imagePullPolicy: Always
-          env:
-            - name: WATCH_NAMESPACE
-              valueFrom:
-                fieldRef:
-                  fieldPath: metadata.namespace
-            - name: OPERATOR_NAME
-              value: "camel-k-operator"
diff --git a/deploy/resources.go b/deploy/resources.go
index 3b40638..c0b8bbf 100644
--- a/deploy/resources.go
+++ b/deploy/resources.go
@@ -356,40 +356,6 @@ spec:
 status:
   loadBalancer: {}
 
-`
- Resources["operator.yaml"] =
- `
-apiVersion: apps/v1
-kind: Deployment
-metadata:
-  name: camel-k-operator
-spec:
-  replicas: 1
-  selector:
-    matchLabels:
-      name: camel-k-operator
-  template:
-    metadata:
-      labels:
-        name: camel-k-operator
-    spec:
-      containers:
-        - name: camel-k-operator
-          image: docker.io/apache/camel-k:0.0.1-SNAPSHOT
-          ports:
-          - containerPort: 60000
-            name: metrics
-          command:
-          - camel-k-operator
-          imagePullPolicy: Always
-          env:
-            - name: WATCH_NAMESPACE
-              valueFrom:
-                fieldRef:
-                  fieldPath: metadata.namespace
-            - name: OPERATOR_NAME
-              value: "camel-k-operator"
-
 `
  Resources["user-cluster-role.yaml"] =
  `
diff --git a/pkg/apis/camel/v1alpha1/types_support.go b/pkg/apis/camel/v1alpha1/types_support.go
index 5168405..fe93a18 100644
--- a/pkg/apis/camel/v1alpha1/types_support.go
+++ b/pkg/apis/camel/v1alpha1/types_support.go
@@ -30,11 +30,11 @@ import (
 // **********************************
 
 func (spec PropertySpec) String() string {
- return fmt.Sprint("%s=%s", spec.Name, spec.Value)
+ return fmt.Sprintf("%s=%s", spec.Name, spec.Value)
 }
 
 func (spec EnvironmentSpec) String() string {
- return fmt.Sprint("%s=%s", spec.Name, spec.Value)
+ return fmt.Sprintf("%s=%s", spec.Name, spec.Value)
 }
 
 // **********************************
diff --git a/pkg/client/cmd/install.go b/pkg/client/cmd/install.go
index 12746c8..0693b36 100644
--- a/pkg/client/cmd/install.go
+++ b/pkg/client/cmd/install.go
@@ -62,7 +62,7 @@ func (o *InstallCmdOptions) install(cmd *cobra.Command, args []string) error {
  } else {
  namespace := o.Namespace
 
- err = install.Operator(namespace)
+ err = install.InstallOperator(namespace)
  if err != nil {
  return err
  }
diff --git a/pkg/install/cluster.go b/pkg/install/cluster.go
index df807bb..4fddf54 100644
--- a/pkg/install/cluster.go
+++ b/pkg/install/cluster.go
@@ -42,7 +42,7 @@ func SetupClusterwideResources() error {
  }
 
  // Installing ClusterRole
- clusterRoleInstalled, err := isClusterRoleInstalled()
+ clusterRoleInstalled, err := IsClusterRoleInstalled()
  if err != nil {
  return err
  }
@@ -56,7 +56,7 @@ func SetupClusterwideResources() error {
  return nil
 }
 
-func isCRDInstalled(name string) (bool, error) {
+func IsCRDInstalled(kind string) (bool, error) {
  lst, err := k8sclient.GetKubeClient().Discovery().ServerResourcesForGroupVersion("camel.apache.org/v1alpha1")
  if err != nil && errors.IsNotFound(err) {
  return false, nil
@@ -64,7 +64,7 @@ func isCRDInstalled(name string) (bool, error) {
  return false, err
  }
  for _, res := range lst.APIResources {
- if res.Kind == name {
+ if res.Kind == kind {
  return true, nil
  }
  }
@@ -73,7 +73,7 @@ func isCRDInstalled(name string) (bool, error) {
 
 func installCRD(kind string, resourceName string) error {
  // Installing Integration CRD
- installed, err := isCRDInstalled(kind)
+ installed, err := IsCRDInstalled(kind)
  if err != nil {
  return err
  }
@@ -104,7 +104,7 @@ func installCRD(kind string, resourceName string) error {
  return nil
 }
 
-func isClusterRoleInstalled() (bool, error) {
+func IsClusterRoleInstalled() (bool, error) {
  clusterRole := v1.ClusterRole{
  TypeMeta: metav1.TypeMeta{
  Kind:       "ClusterRole",
diff --git a/pkg/install/operator.go b/pkg/install/operator.go
index e3bf3f2..a7044f9 100644
--- a/pkg/install/operator.go
+++ b/pkg/install/operator.go
@@ -25,7 +25,7 @@ import (
  metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 )
 
-func Operator(namespace string) error {
+func InstallOperator(namespace string) error {
  return installResources(namespace,
  "operator-service-account.yaml",
  "operator-role-openshift.yaml", // TODO distinguish between Openshift and Kubernetes
diff --git a/pkg/util/maven/maven.go b/pkg/util/maven/maven.go
index 6a0362e..32e1317 100644
--- a/pkg/util/maven/maven.go
+++ b/pkg/util/maven/maven.go
@@ -64,6 +64,8 @@ func Build(project ProjectDefinition) (string, error) {
 func runMavenBuild(buildDir string) error {
  mavenBuild := exec.Command("mvn", mavenExtraOptions(), "clean", "install", "-DskipTests")
  mavenBuild.Dir = buildDir
+ mavenBuild.Stdout = os.Stdout
+ mavenBuild.Stderr = os.Stderr
  logrus.Info("Starting maven build: mvn " + mavenExtraOptions() + " clean install -DskipTests")
  err := mavenBuild.Run()
  if err != nil {
@@ -85,7 +87,7 @@ func mavenExtraOptions() string {
  if _, err := os.Stat("/tmp/artifacts/m2"); err == nil {
  return "-Dmaven.repo.local=/tmp/artifacts/m2"
  }
- return ""
+ return "-Dcamel.noop=true"
 }
 
 func createTar(buildDir string, project ProjectDefinition) (string, error) {
diff --git a/pkg/util/maven/mavent_test.go b/pkg/util/maven/maven_test.go
similarity index 98%
rename from pkg/util/maven/mavent_test.go
rename to pkg/util/maven/maven_test.go
index a22ab3f..7e59e54 100644
--- a/pkg/util/maven/mavent_test.go
+++ b/pkg/util/maven/maven_test.go
@@ -84,7 +84,7 @@ func TestPomGeneration(t *testing.T) {
  },
  }
 
- pom, err := pomFileContent(project)
+ pom, err := GeneratePomFileContent(project)
 
  assert.Nil(t, err)
  assert.NotNil(t, pom)
diff --git a/pkg/util/test/testing_env.go b/pkg/util/test/testing_env.go
deleted file mode 100644
index 16e7e13..0000000
--- a/pkg/util/test/testing_env.go
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-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 test
-
-import "os"
-
-const (
- EnvWatchNamespace = "WATCH_NAMESPACE"
-)
-
-func GetTargetNamespace() string {
- return os.Getenv(EnvWatchNamespace)
-}
diff --git a/pkg/build/build_manager_integration_test.go b/test/build_manager_integration_test.go
similarity index 50%
rename from pkg/build/build_manager_integration_test.go
rename to test/build_manager_integration_test.go
index e271721..d031fb4 100644
--- a/pkg/build/build_manager_integration_test.go
+++ b/test/build_manager_integration_test.go
@@ -1,5 +1,7 @@
 // +build integration
 
+// 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
@@ -17,91 +19,81 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package build
+package test
 
 import (
  "context"
  "testing"
  "time"
 
- build "github.com/apache/camel-k/pkg/build/api"
+ buildapi "github.com/apache/camel-k/pkg/build/api"
  "github.com/apache/camel-k/pkg/util/digest"
- "github.com/apache/camel-k/pkg/util/test"
  "github.com/stretchr/testify/assert"
+ "github.com/apache/camel-k/pkg/build"
 )
 
-func TestBuild(t *testing.T) {
+func TestBuildManagerBuild(t *testing.T) {
  ctx := context.TODO()
- buildManager := NewManager(ctx, test.GetTargetNamespace())
- identifier := build.BuildIdentifier{
+ buildManager := build.NewManager(ctx, GetTargetNamespace())
+ identifier := buildapi.BuildIdentifier{
  Name:   "man-test",
- Digest: digest.Random(),
+ Qualifier: digest.Random(),
  }
- buildManager.Start(build.BuildSource{
+ buildManager.Start(buildapi.BuildSource{
  Identifier: identifier,
- Code: build.Code{
- Content: code(),
+ Code: buildapi.Code{
+ Content: TimerToLogIntegrationCode(),
+ },
+ Dependencies: []string{
+ "mvn:org.apache.camel/camel-core",
+ "camel:telegram",
  },
  })
 
  deadline := time.Now().Add(5 * time.Minute)
- var result build.BuildResult
+ var result buildapi.BuildResult
  for time.Now().Before(deadline) {
  result = buildManager.Get(identifier)
- if result.Status == build.BuildStatusCompleted || result.Status == build.BuildStatusError {
+ if result.Status == buildapi.BuildStatusCompleted || result.Status == buildapi.BuildStatusError {
  break
  }
  time.Sleep(2 * time.Second)
  }
 
- assert.NotEqual(t, build.BuildStatusError, result.Status)
- assert.Equal(t, build.BuildStatusCompleted, result.Status)
+ assert.NotEqual(t, buildapi.BuildStatusError, result.Status)
+ assert.Equal(t, buildapi.BuildStatusCompleted, result.Status)
  assert.Regexp(t, ".*/.*/.*:.*", result.Image)
 }
 
-func TestFailedBuild(t *testing.T) {
+func TestBuildManagerFailedBuild(t *testing.T) {
 
  ctx := context.TODO()
- buildManager := NewManager(ctx, test.GetTargetNamespace())
- identifier := build.BuildIdentifier{
+ buildManager := build.NewManager(ctx, GetTargetNamespace())
+ identifier := buildapi.BuildIdentifier{
  Name:   "man-test-2",
- Digest: digest.Random(),
+ Qualifier: digest.Random(),
  }
- buildManager.Start(build.BuildSource{
+ buildManager.Start(buildapi.BuildSource{
  Identifier: identifier,
- Code: build.Code{
- Content: code() + "XX",
+ Code: buildapi.Code{
+ Content: TimerToLogIntegrationCode(),
+ },
+ Dependencies: []string{
+ "mvn:org.apache.camel/camel-cippalippa",
  },
  })
 
  deadline := time.Now().Add(5 * time.Minute)
- var result build.BuildResult
+ var result buildapi.BuildResult
  for time.Now().Before(deadline) {
  result = buildManager.Get(identifier)
- if result.Status == build.BuildStatusCompleted || result.Status == build.BuildStatusError {
+ if result.Status == buildapi.BuildStatusCompleted || result.Status == buildapi.BuildStatusError {
  break
  }
  time.Sleep(2 * time.Second)
  }
 
- assert.Equal(t, build.BuildStatusError, result.Status)
- assert.NotEqual(t, build.BuildStatusCompleted, result.Status)
+ assert.Equal(t, buildapi.BuildStatusError, result.Status)
+ assert.NotEqual(t, buildapi.BuildStatusCompleted, result.Status)
  assert.Empty(t, result.Image)
 }
-
-func code() string {
- return `package kamel;
-
-import org.apache.camel.builder.RouteBuilder;
-
-public class Routes extends RouteBuilder {
-
- @Override
-    public void configure() throws Exception {
-        from("timer:tick")
-  .to("log:info");
-    }
-
-}
-`
-}
diff --git a/pkg/install/cluster_integration_test.go b/test/cluster_integration_test.go
similarity index 69%
rename from pkg/install/cluster_integration_test.go
rename to test/cluster_integration_test.go
index 1f6b6e4..810ed67 100644
--- a/pkg/install/cluster_integration_test.go
+++ b/test/cluster_integration_test.go
@@ -1,3 +1,7 @@
+// +build integration
+
+// 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
@@ -15,22 +19,24 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package install
+package test
 
 import (
  "github.com/stretchr/testify/assert"
  "testing"
+ "github.com/apache/camel-k/pkg/install"
 )
 
 func TestInstallation(t *testing.T) {
- err := SetupClusterwideResources()
+ installedCtxCRD, err := install.IsCRDInstalled("IntegrationContext")
  assert.Nil(t, err)
+ assert.True(t, installedCtxCRD)
 
- installedCRD, err := isCRDInstalled()
+ installedCRD, err := install.IsCRDInstalled("Integration")
  assert.Nil(t, err)
  assert.True(t, installedCRD)
 
- installedClusterRole, err := isClusterRoleInstalled()
+ installedClusterRole, err := install.IsClusterRoleInstalled()
  assert.Nil(t, err)
  assert.True(t, installedClusterRole)
 }
diff --git a/pkg/build/local/local_builder_integration_test.go b/test/local_builder_integration_test.go
similarity index 73%
rename from pkg/build/local/local_builder_integration_test.go
rename to test/local_builder_integration_test.go
index 967a0ad..79cedeb 100644
--- a/pkg/build/local/local_builder_integration_test.go
+++ b/test/local_builder_integration_test.go
@@ -1,5 +1,7 @@
 // +build integration
 
+// 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
@@ -17,7 +19,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package local
+package test
 
 import (
  "context"
@@ -25,14 +27,14 @@ import (
 
  build "github.com/apache/camel-k/pkg/build/api"
  "github.com/apache/camel-k/pkg/util/digest"
- "github.com/apache/camel-k/pkg/util/test"
  "github.com/stretchr/testify/assert"
+ "github.com/apache/camel-k/pkg/build/local"
 )
 
-func TestBuild(t *testing.T) {
+func TestLocalBuild(t *testing.T) {
 
  ctx := context.TODO()
- builder := NewLocalBuilder(ctx, test.GetTargetNamespace())
+ builder := local.NewLocalBuilder(ctx, GetTargetNamespace())
 
  execution := builder.Build(build.BuildSource{
  Identifier: build.BuildIdentifier{
@@ -40,7 +42,7 @@ func TestBuild(t *testing.T) {
  Qualifier: digest.Random(),
  },
  Code: build.Code{
- Content: code(),
+ Content: TimerToLogIntegrationCode(),
  },
  })
 
@@ -49,10 +51,10 @@ func TestBuild(t *testing.T) {
  assert.Nil(t, res.Error, "Build failed")
 }
 
-func TestDoubleBuild(t *testing.T) {
+func TestLocalDoubleBuild(t *testing.T) {
 
  ctx := context.TODO()
- builder := NewLocalBuilder(ctx, test.GetTargetNamespace())
+ builder := local.NewLocalBuilder(ctx, GetTargetNamespace())
 
  execution1 := builder.Build(build.BuildSource{
  Identifier: build.BuildIdentifier{
@@ -60,7 +62,7 @@ func TestDoubleBuild(t *testing.T) {
  Qualifier: digest.Random(),
  },
  Code: build.Code{
- Content: code(),
+ Content: TimerToLogIntegrationCode(),
  },
  })
 
@@ -70,7 +72,7 @@ func TestDoubleBuild(t *testing.T) {
  Qualifier: digest.Random(),
  },
  Code: build.Code{
- Content: code(),
+ Content: TimerToLogIntegrationCode(),
  },
  })
 
@@ -81,10 +83,10 @@ func TestDoubleBuild(t *testing.T) {
  assert.Nil(t, res2.Error, "Build failed")
 }
 
-func TestFailedBuild(t *testing.T) {
+func TestLocalFailedBuild(t *testing.T) {
 
  ctx := context.TODO()
- builder := NewLocalBuilder(ctx, test.GetTargetNamespace())
+ builder := local.NewLocalBuilder(ctx, GetTargetNamespace())
 
  execution := builder.Build(build.BuildSource{
  Identifier: build.BuildIdentifier{
@@ -92,7 +94,10 @@ func TestFailedBuild(t *testing.T) {
  Qualifier: digest.Random(),
  },
  Code: build.Code{
- Content: code() + "-",
+ Content: TimerToLogIntegrationCode(),
+ },
+ Dependencies: []string{
+ "camel:cippalippa",
  },
  })
 
@@ -100,20 +105,3 @@ func TestFailedBuild(t *testing.T) {
 
  assert.NotNil(t, res.Error, "Build should fail")
 }
-
-func code() string {
- return `package kamel;
-
-import org.apache.camel.builder.RouteBuilder;
-
-public class Routes extends RouteBuilder {
-
- @Override
-    public void configure() throws Exception {
-        from("timer:tick")
-  .to("log:info");
-    }
-
-}
-`
-}
diff --git a/test/testing_env.go b/test/testing_env.go
new file mode 100644
index 0000000..13b0ed8
--- /dev/null
+++ b/test/testing_env.go
@@ -0,0 +1,66 @@
+// +build integration
+
+// 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 test
+
+import (
+ "github.com/apache/camel-k/pkg/util/kubernetes"
+ "github.com/apache/camel-k/pkg/install"
+)
+
+func init() {
+ // Initializes the kubernetes client to auto-detect the context
+ kubernetes.InitKubeClient("")
+
+ err := install.SetupClusterwideResources()
+ if err != nil {
+ panic(err)
+ }
+
+ err = install.InstallOperator(GetTargetNamespace())
+ if err != nil {
+ panic(err)
+ }
+}
+
+func GetTargetNamespace() string {
+ ns, err := kubernetes.GetClientCurrentNamespace("")
+ if err != nil {
+ panic(err)
+ }
+ return ns
+}
+
+func TimerToLogIntegrationCode() string {
+ return `
+import org.apache.camel.builder.RouteBuilder;
+
+public class Routes extends RouteBuilder {
+
+ @Override
+    public void configure() throws Exception {
+        from("timer:tick")
+  .to("log:info");
+    }
+
+}
+`
+}
\ No newline at end of file
diff --git a/version/version.go b/version/version.go
index 6d8b94b..f656e8a 100644
--- a/version/version.go
+++ b/version/version.go
@@ -15,8 +15,10 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
+// Do not change this file manually
 package version
 
 var (
+ // Global Camel K Version
  Version = "0.0.1-SNAPSHOT"
 )


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services