camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nferr...@apache.org
Subject [camel-k] branch master updated: Fix integration tests
Date Wed, 19 Sep 2018 15:34:31 GMT
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


The following commit(s) were added to refs/heads/master by this push:
     new 3e48add  Fix integration tests
3e48add is described below

commit 3e48add99c16861cfc4bffbe5831a87f5ca4707d
Author: nferraro <ni.ferraro@gmail.com>
AuthorDate: Wed Sep 19 17:34:18 2018 +0200

    Fix integration tests
---
 test/build_manager_integration_test.go | 38 ++++++++++++++++++----------------
 test/local_builder_integration_test.go | 26 +++++++++++------------
 2 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/test/build_manager_integration_test.go b/test/build_manager_integration_test.go
index a352009..9ba22f0 100644
--- a/test/build_manager_integration_test.go
+++ b/test/build_manager_integration_test.go
@@ -23,25 +23,26 @@ package test
 
 import (
 	"context"
+	"github.com/apache/camel-k/pkg/build/local"
 	"testing"
 	"time"
 
-	buildapi "github.com/apache/camel-k/pkg/build/api"
+	"github.com/apache/camel-k/pkg/build"
 	"github.com/apache/camel-k/pkg/util/digest"
 	"github.com/stretchr/testify/assert"
-	"github.com/apache/camel-k/pkg/build"
 )
 
 func TestBuildManagerBuild(t *testing.T) {
 	ctx := context.TODO()
-	buildManager := build.NewManager(ctx, getTargetNamespace())
-	identifier := buildapi.BuildIdentifier{
+	namespace := getTargetNamespace()
+	buildManager := build.NewManager(ctx, namespace, local.NewLocalBuilder(ctx, namespace))
+	identifier := build.Identifier{
 		Name:   "man-test",
 		Qualifier: digest.Random(),
 	}
-	buildManager.Start(buildapi.BuildSource{
+	buildManager.Start(build.Request{
 		Identifier: identifier,
-		Code: buildapi.Code{
+		Code: build.Source{
 			Content: createTimerToLogIntegrationCode(),
 		},
 		Dependencies: []string{
@@ -51,31 +52,32 @@ func TestBuildManagerBuild(t *testing.T) {
 	})
 
 	deadline := time.Now().Add(5 * time.Minute)
-	var result buildapi.BuildResult
+	var result build.Result
 	for time.Now().Before(deadline) {
 		result = buildManager.Get(identifier)
-		if result.Status == buildapi.BuildStatusCompleted || result.Status == buildapi.BuildStatusError
{
+		if result.Status == build.StatusCompleted || result.Status == build.StatusError {
 			break
 		}
 		time.Sleep(2 * time.Second)
 	}
 
-	assert.NotEqual(t, buildapi.BuildStatusError, result.Status)
-	assert.Equal(t, buildapi.BuildStatusCompleted, result.Status)
+	assert.NotEqual(t, build.StatusError, result.Status)
+	assert.Equal(t, build.StatusCompleted, result.Status)
 	assert.Regexp(t, ".*/.*/.*:.*", result.Image)
 }
 
 func TestBuildManagerFailedBuild(t *testing.T) {
 
 	ctx := context.TODO()
-	buildManager := build.NewManager(ctx, getTargetNamespace())
-	identifier := buildapi.BuildIdentifier{
+	namespace := getTargetNamespace()
+	buildManager := build.NewManager(ctx, namespace, local.NewLocalBuilder(ctx, namespace))
+	identifier := build.Identifier{
 		Name:   "man-test-2",
 		Qualifier: digest.Random(),
 	}
-	buildManager.Start(buildapi.BuildSource{
+	buildManager.Start(build.Request{
 		Identifier: identifier,
-		Code: buildapi.Code{
+		Code: build.Source{
 			Content: createTimerToLogIntegrationCode(),
 		},
 		Dependencies: []string{
@@ -84,16 +86,16 @@ func TestBuildManagerFailedBuild(t *testing.T) {
 	})
 
 	deadline := time.Now().Add(5 * time.Minute)
-	var result buildapi.BuildResult
+	var result build.Result
 	for time.Now().Before(deadline) {
 		result = buildManager.Get(identifier)
-		if result.Status == buildapi.BuildStatusCompleted || result.Status == buildapi.BuildStatusError
{
+		if result.Status == build.StatusCompleted || result.Status == build.StatusError {
 			break
 		}
 		time.Sleep(2 * time.Second)
 	}
 
-	assert.Equal(t, buildapi.BuildStatusError, result.Status)
-	assert.NotEqual(t, buildapi.BuildStatusCompleted, result.Status)
+	assert.Equal(t, build.StatusError, result.Status)
+	assert.NotEqual(t, build.StatusCompleted, result.Status)
 	assert.Empty(t, result.Image)
 }
diff --git a/test/local_builder_integration_test.go b/test/local_builder_integration_test.go
index 61983ce..c3f35a2 100644
--- a/test/local_builder_integration_test.go
+++ b/test/local_builder_integration_test.go
@@ -25,7 +25,7 @@ import (
 	"context"
 	"testing"
 
-	build "github.com/apache/camel-k/pkg/build/api"
+	"github.com/apache/camel-k/pkg/build"
 	"github.com/apache/camel-k/pkg/util/digest"
 	"github.com/stretchr/testify/assert"
 	"github.com/apache/camel-k/pkg/build/local"
@@ -36,12 +36,12 @@ func TestLocalBuild(t *testing.T) {
 	ctx := context.TODO()
 	builder := local.NewLocalBuilder(ctx, getTargetNamespace())
 
-	execution := builder.Build(build.BuildSource{
-		Identifier: build.BuildIdentifier{
+	execution := builder.Build(build.Request{
+		Identifier: build.Identifier{
 			Name:      "test0",
 			Qualifier: digest.Random(),
 		},
-		Code: build.Code{
+		Code: build.Source{
 			Content: createTimerToLogIntegrationCode(),
 		},
 	})
@@ -56,22 +56,22 @@ func TestLocalDoubleBuild(t *testing.T) {
 	ctx := context.TODO()
 	builder := local.NewLocalBuilder(ctx, getTargetNamespace())
 
-	execution1 := builder.Build(build.BuildSource{
-		Identifier: build.BuildIdentifier{
+	execution1 := builder.Build(build.Request{
+		Identifier: build.Identifier{
 			Name:      "test1",
 			Qualifier: digest.Random(),
 		},
-		Code: build.Code{
+		Code: build.Source{
 			Content: createTimerToLogIntegrationCode(),
 		},
 	})
 
-	execution2 := builder.Build(build.BuildSource{
-		Identifier: build.BuildIdentifier{
+	execution2 := builder.Build(build.Request{
+		Identifier: build.Identifier{
 			Name:      "test2",
 			Qualifier: digest.Random(),
 		},
-		Code: build.Code{
+		Code: build.Source{
 			Content: createTimerToLogIntegrationCode(),
 		},
 	})
@@ -88,12 +88,12 @@ func TestLocalFailedBuild(t *testing.T) {
 	ctx := context.TODO()
 	builder := local.NewLocalBuilder(ctx, getTargetNamespace())
 
-	execution := builder.Build(build.BuildSource{
-		Identifier: build.BuildIdentifier{
+	execution := builder.Build(build.Request{
+		Identifier: build.Identifier{
 			Name:      "test3",
 			Qualifier: digest.Random(),
 		},
-		Code: build.Code{
+		Code: build.Source{
 			Content: createTimerToLogIntegrationCode(),
 		},
 		Dependencies: []string{


Mime
View raw message