diff --git a/Makefile b/Makefile index 10dcd876b..17acf1ab6 100644 --- a/Makefile +++ b/Makefile @@ -121,6 +121,19 @@ test: manifests generate envtest vet fmt test-api ## Run tests. test-api: cd api && make test +###### +# Test proxy commands + +TEST_DIR=testbdd + +.PHONY: run-tests +run-tests: + @(cd $(TEST_DIR) && $(MAKE) $@) + +.PHONY: run-smoke-tests +run-smoke-tests: + @(cd $(TEST_DIR) && $(MAKE) $@) + .PHONY: test-container-builder test-container-builder: cd container-builder && make test diff --git a/bddframework/Makefile b/bddframework/Makefile new file mode 100644 index 000000000..1e37c1e4b --- /dev/null +++ b/bddframework/Makefile @@ -0,0 +1,17 @@ +.PHONY: all +all: test + +##@ Development + +.PHONY: fmt +fmt: ## Run go fmt against code. + go mod tidy + go fmt ./... + +.PHONY: vet +vet: ## Run go vet against code. + go vet ./... + +.PHONY: test +test: fmt vet ## Run tests. + go test ./... -v diff --git a/bddframework/go.sum b/bddframework/go.sum index c1506afc0..98a96c225 100644 --- a/bddframework/go.sum +++ b/bddframework/go.sum @@ -860,6 +860,7 @@ github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24 github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= @@ -982,6 +983,7 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= +go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/automaxprocs v1.4.0/go.mod h1:/mTEdr7LvHhs0v7mjdxDreTz1OG5zdZGqgOnhWiR/+Q= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= @@ -990,6 +992,7 @@ go.uber.org/multierr v0.0.0-20180122172545-ddea229ff1df/go.mod h1:wR5kodmAFQ0UK8 go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= go.uber.org/zap v0.0.0-20180814183419-67bc79d13d15/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= @@ -1061,6 +1064,7 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= +golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= diff --git a/bddframework/pkg/api/app/v1beta1/kogitoservices.go b/bddframework/pkg/api/app/v1beta1/kogitoservices.go index 6ec6a4518..a8e691516 100644 --- a/bddframework/pkg/api/app/v1beta1/kogitoservices.go +++ b/bddframework/pkg/api/app/v1beta1/kogitoservices.go @@ -15,11 +15,12 @@ package v1beta1 import ( - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/api" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/api" ) // KogitoServiceStatus is the basic structure for any Kogito Service status. diff --git a/bddframework/pkg/api/app/v1beta1/kogitosupportingservice_types.go b/bddframework/pkg/api/app/v1beta1/kogitosupportingservice_types.go index e8ae4ea6d..bb2ea2592 100644 --- a/bddframework/pkg/api/app/v1beta1/kogitosupportingservice_types.go +++ b/bddframework/pkg/api/app/v1beta1/kogitosupportingservice_types.go @@ -15,8 +15,9 @@ package v1beta1 import ( - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/api" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/api" ) // KogitoSupportingServiceSpec defines the desired state of KogitoSupportingService. diff --git a/bddframework/pkg/api/app/v1beta1/kogitosupportingservice_types_test.go b/bddframework/pkg/api/app/v1beta1/kogitosupportingservice_types_test.go index 15f720abb..c3684139d 100644 --- a/bddframework/pkg/api/app/v1beta1/kogitosupportingservice_types_test.go +++ b/bddframework/pkg/api/app/v1beta1/kogitosupportingservice_types_test.go @@ -15,10 +15,12 @@ package v1beta1 import ( - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/api" + "testing" + "github.com/stretchr/testify/assert" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "testing" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/api" ) func TestGetItems(t *testing.T) { diff --git a/bddframework/pkg/api/app/v1beta1/zz_generated.deepcopy.go b/bddframework/pkg/api/app/v1beta1/zz_generated.deepcopy.go index 27d54fc8c..52be5722e 100644 --- a/bddframework/pkg/api/app/v1beta1/zz_generated.deepcopy.go +++ b/bddframework/pkg/api/app/v1beta1/zz_generated.deepcopy.go @@ -21,7 +21,7 @@ package v1beta1 import ( appsv1 "k8s.io/api/apps/v1" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -66,8 +66,6 @@ func (in *KogitoCloudEventsStatus) DeepCopy() *KogitoCloudEventsStatus { return out } - - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KogitoProbe) DeepCopyInto(out *KogitoProbe) { *out = *in diff --git a/bddframework/pkg/api/hyperfoil/v1alpha2/groupversion_info.go b/bddframework/pkg/api/hyperfoil/v1alpha2/groupversion_info.go index 23697f5bd..3f3799038 100644 --- a/bddframework/pkg/api/hyperfoil/v1alpha2/groupversion_info.go +++ b/bddframework/pkg/api/hyperfoil/v1alpha2/groupversion_info.go @@ -15,8 +15,8 @@ limitations under the License. */ // Package v1alpha2 contains API Schema definitions for the v1alpha2 API group -//+kubebuilder:object:generate=true -//+groupName=hyperfoil.io +// +kubebuilder:object:generate=true +// +groupName=hyperfoil.io package v1alpha2 import ( diff --git a/bddframework/pkg/api/hyperfoil/v1alpha2/zz_generated.deepcopy.go b/bddframework/pkg/api/hyperfoil/v1alpha2/zz_generated.deepcopy.go index b97482788..23680c575 100644 --- a/bddframework/pkg/api/hyperfoil/v1alpha2/zz_generated.deepcopy.go +++ b/bddframework/pkg/api/hyperfoil/v1alpha2/zz_generated.deepcopy.go @@ -1,3 +1,4 @@ +//go:build !ignore_autogenerated // +build !ignore_autogenerated /* diff --git a/bddframework/pkg/config/config.go b/bddframework/pkg/config/config.go index 550d03de6..62c9669e3 100644 --- a/bddframework/pkg/config/config.go +++ b/bddframework/pkg/config/config.go @@ -97,7 +97,7 @@ type TestConfig struct { } const ( - defaultOperatorYamlURI = "../kogito-operator.yaml" + defaultOperatorYamlURI = "../operator.yaml" defaultRhpamOperatorYamlURI = "../rhpam-operator.yaml" defaultCliPath = "../build/_output/bin/kogito" diff --git a/bddframework/pkg/framework/client/client.go b/bddframework/pkg/framework/client/client.go index 4f981d53b..0ca496ff9 100644 --- a/bddframework/pkg/framework/client/client.go +++ b/bddframework/pkg/framework/client/client.go @@ -20,12 +20,13 @@ import ( "path/filepath" "strings" - frameworklogger "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/logger" rbac "k8s.io/api/rbac/v1" "k8s.io/apimachinery/pkg/runtime" controllerruntime "sigs.k8s.io/controller-runtime" logger "sigs.k8s.io/controller-runtime/pkg/log" + frameworklogger "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/logger" + appsv1 "github.com/openshift/client-go/apps/clientset/versioned/typed/apps/v1" corev1 "k8s.io/api/core/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" diff --git a/bddframework/pkg/framework/client/client_builder.go b/bddframework/pkg/framework/client/client_builder.go index 8e010a6f4..95093b389 100644 --- a/bddframework/pkg/framework/client/client_builder.go +++ b/bddframework/pkg/framework/client/client_builder.go @@ -16,6 +16,7 @@ package client import ( "fmt" + "k8s.io/apimachinery/pkg/runtime" appsv1 "github.com/openshift/client-go/apps/clientset/versioned/typed/apps/v1" diff --git a/bddframework/pkg/framework/client/kubernetes/event.go b/bddframework/pkg/framework/client/kubernetes/event.go index 53e88e1a8..205b0b0e6 100644 --- a/bddframework/pkg/framework/client/kubernetes/event.go +++ b/bddframework/pkg/framework/client/kubernetes/event.go @@ -16,6 +16,7 @@ package kubernetes import ( "context" + v1beta1 "k8s.io/api/events/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/bddframework/pkg/framework/client/kubernetes/kubernetes.go b/bddframework/pkg/framework/client/kubernetes/kubernetes.go index cd03fd48b..c238ee0ae 100644 --- a/bddframework/pkg/framework/client/kubernetes/kubernetes.go +++ b/bddframework/pkg/framework/client/kubernetes/kubernetes.go @@ -15,9 +15,10 @@ package kubernetes import ( + logger "sigs.k8s.io/controller-runtime/pkg/log" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client" frameworklogger "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/logger" - logger "sigs.k8s.io/controller-runtime/pkg/log" ) var log = frameworklogger.Logger{Logger: logger.Log.WithName("kubernetes_client")} diff --git a/bddframework/pkg/framework/client/kubernetes/namespace.go b/bddframework/pkg/framework/client/kubernetes/namespace.go index 477ad0102..aad20740c 100644 --- a/bddframework/pkg/framework/client/kubernetes/namespace.go +++ b/bddframework/pkg/framework/client/kubernetes/namespace.go @@ -17,11 +17,12 @@ package kubernetes import ( "context" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client" ) // NamespaceInterface has functions that interacts with namespace object in the Kubernetes cluster diff --git a/bddframework/pkg/framework/client/kubernetes/pod.go b/bddframework/pkg/framework/client/kubernetes/pod.go index 07dac338f..2a58b50db 100644 --- a/bddframework/pkg/framework/client/kubernetes/pod.go +++ b/bddframework/pkg/framework/client/kubernetes/pod.go @@ -18,8 +18,9 @@ import ( "context" "io/ioutil" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client" corev1 "k8s.io/api/core/v1" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client" ) // PodInterface has functions that interacts with pod object in the Kubernetes cluster diff --git a/bddframework/pkg/framework/client/kubernetes/resource.go b/bddframework/pkg/framework/client/kubernetes/resource.go index ad93d418e..3b0fef6af 100644 --- a/bddframework/pkg/framework/client/kubernetes/resource.go +++ b/bddframework/pkg/framework/client/kubernetes/resource.go @@ -18,12 +18,13 @@ import ( "fmt" "strings" - kogitocli "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + kogitocli "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client" + "k8s.io/apimachinery/pkg/util/yaml" ) diff --git a/bddframework/pkg/framework/client/kubernetes/resource_reader.go b/bddframework/pkg/framework/client/kubernetes/resource_reader.go index 2ef63295a..92609dba9 100644 --- a/bddframework/pkg/framework/client/kubernetes/resource_reader.go +++ b/bddframework/pkg/framework/client/kubernetes/resource_reader.go @@ -16,13 +16,15 @@ package kubernetes import ( "context" + "reflect" + "github.com/RHsyseng/operator-utils/pkg/resource/read" - kogitocli "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "reflect" "sigs.k8s.io/controller-runtime/pkg/client" + + kogitocli "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client" ) // ResourceReader interface to read kubernetes object diff --git a/bddframework/pkg/framework/client/kubernetes/resource_writer.go b/bddframework/pkg/framework/client/kubernetes/resource_writer.go index 34a3b9ee8..e6202b1d2 100644 --- a/bddframework/pkg/framework/client/kubernetes/resource_writer.go +++ b/bddframework/pkg/framework/client/kubernetes/resource_writer.go @@ -16,9 +16,11 @@ package kubernetes import ( "context" + "github.com/RHsyseng/operator-utils/pkg/resource/write" - kogitocli "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client" "sigs.k8s.io/controller-runtime/pkg/client" + + kogitocli "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client" ) // ResourceWriter interface to write kubernetes object diff --git a/bddframework/pkg/framework/client/test/kubeconfig.go b/bddframework/pkg/framework/client/test/kubeconfig.go index 3ebf7da85..13aca31ca 100644 --- a/bddframework/pkg/framework/client/test/kubeconfig.go +++ b/bddframework/pkg/framework/client/test/kubeconfig.go @@ -16,9 +16,10 @@ package test import ( "fmt" + "os" + "k8s.io/client-go/tools/clientcmd" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" - "os" ) const ( diff --git a/bddframework/pkg/framework/command.go b/bddframework/pkg/framework/command.go index df32acac1..ec28401a6 100644 --- a/bddframework/pkg/framework/command.go +++ b/bddframework/pkg/framework/command.go @@ -15,10 +15,11 @@ package framework import ( - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/logger" "os/exec" "sync" "time" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/logger" ) var ( diff --git a/bddframework/pkg/framework/env/env.go b/bddframework/pkg/framework/env/env.go index dbb1f19c5..617970c30 100644 --- a/bddframework/pkg/framework/env/env.go +++ b/bddframework/pkg/framework/env/env.go @@ -1,3 +1,17 @@ +// Copyright 2023 Red Hat, Inc. and/or its affiliates +// +// Licensed 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 env import ( diff --git a/bddframework/pkg/framework/grafana.go b/bddframework/pkg/framework/grafana.go index e1b02626a..c1070ccdf 100644 --- a/bddframework/pkg/framework/grafana.go +++ b/bddframework/pkg/framework/grafana.go @@ -16,6 +16,7 @@ package framework import ( "fmt" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" diff --git a/bddframework/pkg/framework/graphql.go b/bddframework/pkg/framework/graphql.go index 6772bf5d6..6623c8526 100644 --- a/bddframework/pkg/framework/graphql.go +++ b/bddframework/pkg/framework/graphql.go @@ -22,8 +22,9 @@ import ( "strings" "time" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" "github.com/machinebox/graphql" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" ) const graphQLNoAuthToken = "" diff --git a/bddframework/pkg/framework/infinispan.go b/bddframework/pkg/framework/infinispan.go index b51f3a30a..0cb646450 100644 --- a/bddframework/pkg/framework/infinispan.go +++ b/bddframework/pkg/framework/infinispan.go @@ -16,6 +16,7 @@ package framework import ( "fmt" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/operator" @@ -25,9 +26,10 @@ import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/types" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" infinispan "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/infinispan/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // DeployInfinispanInstance deploys an instance of Infinispan diff --git a/bddframework/pkg/framework/infrastructure/grafana/v1alpha1/zz_generated.deepcopy.go b/bddframework/pkg/framework/infrastructure/grafana/v1alpha1/zz_generated.deepcopy.go index c3b27d93d..16ea1ec9a 100644 --- a/bddframework/pkg/framework/infrastructure/grafana/v1alpha1/zz_generated.deepcopy.go +++ b/bddframework/pkg/framework/infrastructure/grafana/v1alpha1/zz_generated.deepcopy.go @@ -21,7 +21,7 @@ package v1alpha1 import ( appsv1 "k8s.io/api/apps/v1" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) diff --git a/bddframework/pkg/framework/infrastructure/infinispan.go b/bddframework/pkg/framework/infrastructure/infinispan.go index ac89a09c3..5140cc61d 100644 --- a/bddframework/pkg/framework/infrastructure/infinispan.go +++ b/bddframework/pkg/framework/infrastructure/infinispan.go @@ -16,13 +16,15 @@ package infrastructure import ( "fmt" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" - ispn "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/infinispan/v1" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/operator" + "gopkg.in/yaml.v2" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" + ispn "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/infinispan/v1" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/operator" ) const ( diff --git a/bddframework/pkg/framework/infrastructure/infinispan/v1/infinispan_types.go b/bddframework/pkg/framework/infrastructure/infinispan/v1/infinispan_types.go index ffe778fc3..b0788bde1 100644 --- a/bddframework/pkg/framework/infrastructure/infinispan/v1/infinispan_types.go +++ b/bddframework/pkg/framework/infrastructure/infinispan/v1/infinispan_types.go @@ -19,10 +19,11 @@ package v1 import ( "fmt" + "strings" + "github.com/RHsyseng/operator-utils/pkg/olm" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "strings" ) // InfinispanSecurity info for the user application connection diff --git a/bddframework/pkg/framework/infrastructure/kafka.go b/bddframework/pkg/framework/infrastructure/kafka.go index ad94201ad..707b0aa69 100644 --- a/bddframework/pkg/framework/infrastructure/kafka.go +++ b/bddframework/pkg/framework/infrastructure/kafka.go @@ -17,11 +17,12 @@ package infrastructure import ( "fmt" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/kafka/v1beta2" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/operator" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" ) const ( diff --git a/bddframework/pkg/framework/infrastructure/kafka/v1beta2/kafka_types.go b/bddframework/pkg/framework/infrastructure/kafka/v1beta2/kafka_types.go index 38d20508a..6b9f663e4 100644 --- a/bddframework/pkg/framework/infrastructure/kafka/v1beta2/kafka_types.go +++ b/bddframework/pkg/framework/infrastructure/kafka/v1beta2/kafka_types.go @@ -15,9 +15,10 @@ package v1beta2 import ( + "time" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "time" ) // KafkaSpec defines the desired state of Kafka diff --git a/bddframework/pkg/framework/infrastructure/kafka_test.go b/bddframework/pkg/framework/infrastructure/kafka_test.go index 4342ed6b6..12ef238ca 100644 --- a/bddframework/pkg/framework/infrastructure/kafka_test.go +++ b/bddframework/pkg/framework/infrastructure/kafka_test.go @@ -15,16 +15,18 @@ package infrastructure import ( + "reflect" + "testing" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/log" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/kafka/v1beta2" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/logger" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/operator" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/meta" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - "reflect" - "sigs.k8s.io/controller-runtime/pkg/log" - "testing" ) func Test_getKafkaInstanceWithName(t *testing.T) { diff --git a/bddframework/pkg/framework/infrastructure/keycloak/v1alpha1/zz_generated.deepcopy.go b/bddframework/pkg/framework/infrastructure/keycloak/v1alpha1/zz_generated.deepcopy.go index e5c3e4366..825afba20 100644 --- a/bddframework/pkg/framework/infrastructure/keycloak/v1alpha1/zz_generated.deepcopy.go +++ b/bddframework/pkg/framework/infrastructure/keycloak/v1alpha1/zz_generated.deepcopy.go @@ -20,7 +20,7 @@ package v1alpha1 import ( - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" diff --git a/bddframework/pkg/framework/infrastructure/mongodb.go b/bddframework/pkg/framework/infrastructure/mongodb.go index 0aec409e2..2cc2f5deb 100644 --- a/bddframework/pkg/framework/infrastructure/mongodb.go +++ b/bddframework/pkg/framework/infrastructure/mongodb.go @@ -15,12 +15,13 @@ package infrastructure import ( - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" - mongodb "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/mongodb/v1" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/operator" v1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" + mongodb "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/mongodb/v1" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/operator" ) const ( diff --git a/bddframework/pkg/framework/infrastructure/testutil.go b/bddframework/pkg/framework/infrastructure/testutil.go index 543b5373d..2d9cf7f10 100644 --- a/bddframework/pkg/framework/infrastructure/testutil.go +++ b/bddframework/pkg/framework/infrastructure/testutil.go @@ -15,8 +15,6 @@ package infrastructure import ( - kogitocli "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/meta" buildfake "github.com/openshift/client-go/build/clientset/versioned/fake" v1 "github.com/openshift/client-go/build/clientset/versioned/typed/build/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -28,6 +26,9 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" + kogitocli "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/meta" + imgfake "github.com/openshift/client-go/image/clientset/versioned/fake" ) diff --git a/bddframework/pkg/framework/keycloak.go b/bddframework/pkg/framework/keycloak.go index f7d9a59b3..6102adef7 100644 --- a/bddframework/pkg/framework/keycloak.go +++ b/bddframework/pkg/framework/keycloak.go @@ -19,9 +19,10 @@ import ( "fmt" "regexp" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" + keycloak "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/keycloak/v1alpha1" ) diff --git a/bddframework/pkg/framework/knative.go b/bddframework/pkg/framework/knative.go index 8064c98c4..f0d9560ad 100644 --- a/bddframework/pkg/framework/knative.go +++ b/bddframework/pkg/framework/knative.go @@ -16,7 +16,7 @@ package framework import ( "fmt" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -24,6 +24,8 @@ import ( eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" "knative.dev/pkg/apis" duckv1 "knative.dev/pkg/apis/duck/v1" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" ) // DeployBroker deploys Knative Broker diff --git a/bddframework/pkg/framework/kogitojobsservice.go b/bddframework/pkg/framework/kogitojobsservice.go index 168c02fb9..1afd54eb2 100644 --- a/bddframework/pkg/framework/kogitojobsservice.go +++ b/bddframework/pkg/framework/kogitojobsservice.go @@ -16,14 +16,16 @@ package framework import ( "fmt" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/api/app/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/types" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/api" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" bddtypes "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/types" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/types" ) const ( diff --git a/bddframework/pkg/framework/kogitoserviceutils.go b/bddframework/pkg/framework/kogitoserviceutils.go index 3db63be3c..c2f2a0bc1 100644 --- a/bddframework/pkg/framework/kogitoserviceutils.go +++ b/bddframework/pkg/framework/kogitoserviceutils.go @@ -16,15 +16,17 @@ package framework import ( "fmt" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/api/app/v1beta1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/api" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" bddtypes "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/types" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" ) // InstallService install the Kogito Service component diff --git a/bddframework/pkg/framework/kubernetes.go b/bddframework/pkg/framework/kubernetes.go index e94c8f0e0..d6d76e6b2 100644 --- a/bddframework/pkg/framework/kubernetes.go +++ b/bddframework/pkg/framework/kubernetes.go @@ -24,9 +24,6 @@ import ( rbac "k8s.io/api/rbac/v1" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" - kogitocli "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" apps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" k8sv1beta1 "k8s.io/api/extensions/v1beta1" @@ -36,6 +33,11 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" + kogitocli "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/meta" ) var ( @@ -649,3 +651,24 @@ func IsConfigMapExist(key types.NamespacedName) (bool, error) { } return exists, nil } + +// PruneNamespaces prunes namespaces stored in the "logs/namespace_history.log" file +func PruneNamespaces() error { + // Create kube client + if err := InitKubeClient(meta.GetRegisteredSchema()); err != nil { + return err + } + + namespaces := GetNamespacesInHistory() + for _, namespace := range namespaces { + if len(namespace) > 0 { + err := DeleteNamespace(namespace) + if err != nil { + GetMainLogger().Error(err, "Error in deleting namespace") + } + } + } + + ClearNamespaceHistory() + return nil +} diff --git a/bddframework/pkg/framework/logger/logger.go b/bddframework/pkg/framework/logger/logger.go index dc4b69538..89b485b55 100644 --- a/bddframework/pkg/framework/logger/logger.go +++ b/bddframework/pkg/framework/logger/logger.go @@ -15,16 +15,18 @@ package logger import ( + "io" + "os" + "time" + "github.com/go-logr/logr" "github.com/go-logr/zapr" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/env" "go.uber.org/zap" "go.uber.org/zap/zapcore" - "io" - "os" logf "sigs.k8s.io/controller-runtime/pkg/log" logzap "sigs.k8s.io/controller-runtime/pkg/log/zap" - "time" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/env" ) var ( diff --git a/bddframework/pkg/framework/logging.go b/bddframework/pkg/framework/logging.go index fb9b58672..080702c66 100644 --- a/bddframework/pkg/framework/logging.go +++ b/bddframework/pkg/framework/logging.go @@ -19,20 +19,24 @@ import ( "encoding/json" "errors" "fmt" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/env" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/logger" "io" "os" "reflect" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/log" "strings" "sync" "time" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/log" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/env" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/logger" + "io/ioutil" + "k8s.io/api/events/v1beta1" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" ) const ( diff --git a/bddframework/pkg/framework/mongodb.go b/bddframework/pkg/framework/mongodb.go index 31d1f4a7b..ca042837c 100644 --- a/bddframework/pkg/framework/mongodb.go +++ b/bddframework/pkg/framework/mongodb.go @@ -16,16 +16,18 @@ package framework import ( "fmt" + v1 "k8s.io/api/apps/v1" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/operator" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/meta" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" - mongodb "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/mongodb/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" + mongodb "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/mongodb/v1" ) const ( diff --git a/bddframework/pkg/framework/namespace.go b/bddframework/pkg/framework/namespace.go index dfb86efcc..010eb2cd0 100644 --- a/bddframework/pkg/framework/namespace.go +++ b/bddframework/pkg/framework/namespace.go @@ -16,14 +16,14 @@ package framework import ( "fmt" - "io/ioutil" "os" "strings" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" ) const ( @@ -89,7 +89,7 @@ func OperateOnNamespaceIfExists(namespace string, operate func(namespace string) // GetNamespacesInHistory retrieves all the namespaces in the history. func GetNamespacesInHistory() []string { - input, err := ioutil.ReadFile(namespaceLogFile) + input, err := os.ReadFile(namespaceLogFile) if err != nil { // file does not exist return []string{} @@ -131,5 +131,5 @@ func removeNamespaceFromHistory(namespace string) error { } output := strings.Join(newNamespaces, "\n") - return ioutil.WriteFile(namespaceLogFile, []byte(output), permissionMode) + return os.WriteFile(namespaceLogFile, []byte(output), permissionMode) } diff --git a/bddframework/pkg/framework/openshift.go b/bddframework/pkg/framework/openshift.go index 11738b6bb..544689af2 100644 --- a/bddframework/pkg/framework/openshift.go +++ b/bddframework/pkg/framework/openshift.go @@ -23,14 +23,15 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" ocapps "github.com/openshift/api/apps/v1" buildv1 "github.com/openshift/api/build/v1" imagev1 "github.com/openshift/api/image/v1" routev1 "github.com/openshift/api/route/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/types" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" ) const ( diff --git a/bddframework/pkg/framework/operator.go b/bddframework/pkg/framework/operator.go index 941c5c25f..3d628afdc 100644 --- a/bddframework/pkg/framework/operator.go +++ b/bddframework/pkg/framework/operator.go @@ -16,6 +16,7 @@ package framework import ( "fmt" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/meta" diff --git a/bddframework/pkg/framework/operator/context.go b/bddframework/pkg/framework/operator/context.go index 19f3bc4e7..7cb6cc797 100644 --- a/bddframework/pkg/framework/operator/context.go +++ b/bddframework/pkg/framework/operator/context.go @@ -15,9 +15,10 @@ package operator import ( + "k8s.io/apimachinery/pkg/runtime" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/logger" - "k8s.io/apimachinery/pkg/runtime" ) // Context ... diff --git a/bddframework/pkg/framework/postgresql.go b/bddframework/pkg/framework/postgresql.go index 301140592..606d380b9 100644 --- a/bddframework/pkg/framework/postgresql.go +++ b/bddframework/pkg/framework/postgresql.go @@ -16,6 +16,7 @@ package framework import ( "fmt" + apps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1" diff --git a/bddframework/pkg/framework/prometheus.go b/bddframework/pkg/framework/prometheus.go index db40227e7..1213ea54f 100644 --- a/bddframework/pkg/framework/prometheus.go +++ b/bddframework/pkg/framework/prometheus.go @@ -16,10 +16,12 @@ package framework import ( "fmt" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" monv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" ) const ( diff --git a/bddframework/pkg/framework/subscription.go b/bddframework/pkg/framework/subscription.go index 4585c08b3..ed1be1c6e 100644 --- a/bddframework/pkg/framework/subscription.go +++ b/bddframework/pkg/framework/subscription.go @@ -15,9 +15,10 @@ package framework import ( + olmapiv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/client/kubernetes" - olmapiv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" ) // getSubscription returns subscription or nil if no subscription is found. diff --git a/bddframework/pkg/framework/util.go b/bddframework/pkg/framework/util.go index c1f6aa5a4..8865dbfbc 100644 --- a/bddframework/pkg/framework/util.go +++ b/bddframework/pkg/framework/util.go @@ -16,11 +16,8 @@ package framework import ( "fmt" - "github.com/google/uuid" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/env" "io" "io/ioutil" - "k8s.io/apimachinery/pkg/types" "math/rand" "net/http" "os" @@ -28,6 +25,11 @@ import ( "strings" "time" + "github.com/google/uuid" + "k8s.io/apimachinery/pkg/types" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/env" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/api" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" "github.com/kiegroup/kogito-serverless-operator/version" diff --git a/bddframework/pkg/installers/amqstreams_installer.go b/bddframework/pkg/installers/amqstreams_installer.go index 7e45dbbdc..a509ef61d 100644 --- a/bddframework/pkg/installers/amqstreams_installer.go +++ b/bddframework/pkg/installers/amqstreams_installer.go @@ -15,9 +15,10 @@ package installers import ( + "sigs.k8s.io/controller-runtime/pkg/client" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/kafka/v1beta2" - "sigs.k8s.io/controller-runtime/pkg/client" ) var ( diff --git a/bddframework/pkg/installers/grafana_installer.go b/bddframework/pkg/installers/grafana_installer.go index 3891ad683..800f6b4ba 100644 --- a/bddframework/pkg/installers/grafana_installer.go +++ b/bddframework/pkg/installers/grafana_installer.go @@ -15,9 +15,10 @@ package installers import ( + "sigs.k8s.io/controller-runtime/pkg/client" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" grafanav1 "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/grafana/v1alpha1" - "sigs.k8s.io/controller-runtime/pkg/client" ) var ( diff --git a/bddframework/pkg/installers/hyperfoil_installer.go b/bddframework/pkg/installers/hyperfoil_installer.go index 7a70118f8..c25f905f3 100644 --- a/bddframework/pkg/installers/hyperfoil_installer.go +++ b/bddframework/pkg/installers/hyperfoil_installer.go @@ -15,9 +15,10 @@ package installers import ( + "sigs.k8s.io/controller-runtime/pkg/client" + hyperfoil "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/api/hyperfoil/v1alpha2" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" - "sigs.k8s.io/controller-runtime/pkg/client" ) var ( diff --git a/bddframework/pkg/installers/hyperfoil_node_scraper_installer.go b/bddframework/pkg/installers/hyperfoil_node_scraper_installer.go index 95917e45d..866ac4cfd 100644 --- a/bddframework/pkg/installers/hyperfoil_node_scraper_installer.go +++ b/bddframework/pkg/installers/hyperfoil_node_scraper_installer.go @@ -16,13 +16,15 @@ package installers import ( "fmt" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" + appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" rbac "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" ) const ( diff --git a/bddframework/pkg/installers/infinispan_installer.go b/bddframework/pkg/installers/infinispan_installer.go index 358eec1ec..2650f4090 100644 --- a/bddframework/pkg/installers/infinispan_installer.go +++ b/bddframework/pkg/installers/infinispan_installer.go @@ -17,15 +17,17 @@ package installers import ( "errors" "fmt" + "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" - ispn "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/infinispan/v1" coreapps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" rbac "k8s.io/api/rbac/v1" apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" + ispn "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/infinispan/v1" ) var ( diff --git a/bddframework/pkg/installers/kafka_installer.go b/bddframework/pkg/installers/kafka_installer.go index b3de3d51b..743fe9555 100644 --- a/bddframework/pkg/installers/kafka_installer.go +++ b/bddframework/pkg/installers/kafka_installer.go @@ -15,9 +15,10 @@ package installers import ( + "sigs.k8s.io/controller-runtime/pkg/client" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/kafka/v1beta2" - "sigs.k8s.io/controller-runtime/pkg/client" ) var ( diff --git a/bddframework/pkg/installers/keycloak_installer.go b/bddframework/pkg/installers/keycloak_installer.go index 2a8a62b31..2943f9444 100644 --- a/bddframework/pkg/installers/keycloak_installer.go +++ b/bddframework/pkg/installers/keycloak_installer.go @@ -15,9 +15,10 @@ package installers import ( + "sigs.k8s.io/controller-runtime/pkg/client" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" keycloak "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/keycloak/v1alpha1" - "sigs.k8s.io/controller-runtime/pkg/client" ) var ( diff --git a/bddframework/pkg/installers/knative-eventing-kogito-installer.go b/bddframework/pkg/installers/knative-eventing-kogito-installer.go index 942260871..fbfc1827c 100644 --- a/bddframework/pkg/installers/knative-eventing-kogito-installer.go +++ b/bddframework/pkg/installers/knative-eventing-kogito-installer.go @@ -16,8 +16,10 @@ package installers import ( "fmt" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" ) var ( diff --git a/bddframework/pkg/installers/knative_installer.go b/bddframework/pkg/installers/knative_installer.go index 220dd2212..3c7fa67c5 100644 --- a/bddframework/pkg/installers/knative_installer.go +++ b/bddframework/pkg/installers/knative_installer.go @@ -16,10 +16,12 @@ package installers import ( "fmt" + "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" ) var ( diff --git a/bddframework/pkg/installers/mongodb_installer.go b/bddframework/pkg/installers/mongodb_installer.go index 19157d871..5a6df9d95 100644 --- a/bddframework/pkg/installers/mongodb_installer.go +++ b/bddframework/pkg/installers/mongodb_installer.go @@ -16,13 +16,15 @@ package installers import ( "fmt" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" - mongodbv1 "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/mongodb/v1" + coreapps "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" rbac "k8s.io/api/rbac/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" + mongodbv1 "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/mongodb/v1" ) var ( diff --git a/bddframework/pkg/installers/prometheus_installer.go b/bddframework/pkg/installers/prometheus_installer.go index 380fa7b8e..af060ef1e 100644 --- a/bddframework/pkg/installers/prometheus_installer.go +++ b/bddframework/pkg/installers/prometheus_installer.go @@ -15,9 +15,10 @@ package installers import ( - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" monv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" ) var ( diff --git a/bddframework/pkg/installers/service_installer.go b/bddframework/pkg/installers/service_installer.go index 9226a808f..400ae6bc1 100644 --- a/bddframework/pkg/installers/service_installer.go +++ b/bddframework/pkg/installers/service_installer.go @@ -16,10 +16,11 @@ package installers import ( "fmt" - "sigs.k8s.io/controller-runtime/pkg/client" "sync" "time" + "sigs.k8s.io/controller-runtime/pkg/client" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" ) diff --git a/bddframework/pkg/meta/meta.go b/bddframework/pkg/meta/meta.go index 56038af9e..9208af49b 100644 --- a/bddframework/pkg/meta/meta.go +++ b/bddframework/pkg/meta/meta.go @@ -15,12 +15,6 @@ package meta import ( - hyperfoil "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/api/hyperfoil/v1alpha2" - grafana "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/grafana/v1alpha1" - infinispan "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/infinispan/v1" - kafka "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/kafka/v1beta2" - keycloak "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/keycloak/v1alpha1" - mongodb "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/mongodb/v1" appsv1 "github.com/openshift/api/apps/v1" buildv1 "github.com/openshift/api/build/v1" imgv1 "github.com/openshift/api/image/v1" @@ -31,6 +25,13 @@ import ( eventing "knative.dev/eventing/pkg/apis/eventing/v1" sources "knative.dev/eventing/pkg/apis/sources/v1" + hyperfoil "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/api/hyperfoil/v1alpha2" + grafana "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/grafana/v1alpha1" + infinispan "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/infinispan/v1" + kafka "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/kafka/v1beta2" + keycloak "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/keycloak/v1alpha1" + mongodb "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/mongodb/v1" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" diff --git a/bddframework/pkg/steps/data.go b/bddframework/pkg/steps/data.go index 94ee7b606..4e5547808 100644 --- a/bddframework/pkg/steps/data.go +++ b/bddframework/pkg/steps/data.go @@ -23,9 +23,10 @@ import ( "github.com/cucumber/messages-go/v16" "github.com/cucumber/godog" + "sigs.k8s.io/controller-runtime/pkg/client" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" - "sigs.k8s.io/controller-runtime/pkg/client" ) var ( diff --git a/bddframework/pkg/steps/git.go b/bddframework/pkg/steps/git.go index 0ddd5a2da..2affdec3f 100644 --- a/bddframework/pkg/steps/git.go +++ b/bddframework/pkg/steps/git.go @@ -16,10 +16,11 @@ package steps import ( "github.com/cucumber/godog" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" git "gopkg.in/src-d/go-git.v4" "gopkg.in/src-d/go-git.v4/plumbing" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" ) // registerGitSteps register all existing GIT steps diff --git a/bddframework/pkg/steps/grafana.go b/bddframework/pkg/steps/grafana.go index 49f41e139..399bd7fc1 100644 --- a/bddframework/pkg/steps/grafana.go +++ b/bddframework/pkg/steps/grafana.go @@ -16,6 +16,7 @@ package steps import ( "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/installers" ) diff --git a/bddframework/pkg/steps/graphql.go b/bddframework/pkg/steps/graphql.go index 7c8a4a565..2e2172abc 100644 --- a/bddframework/pkg/steps/graphql.go +++ b/bddframework/pkg/steps/graphql.go @@ -21,6 +21,7 @@ import ( "time" "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" ) diff --git a/bddframework/pkg/steps/http.go b/bddframework/pkg/steps/http.go index 9d5ce021f..c12383882 100644 --- a/bddframework/pkg/steps/http.go +++ b/bddframework/pkg/steps/http.go @@ -20,6 +20,7 @@ import ( "time" "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" ) diff --git a/bddframework/pkg/steps/hyperfoil.go b/bddframework/pkg/steps/hyperfoil.go index 2f133df9e..035e83768 100644 --- a/bddframework/pkg/steps/hyperfoil.go +++ b/bddframework/pkg/steps/hyperfoil.go @@ -17,13 +17,15 @@ package steps import ( "errors" "fmt" + "github.com/cucumber/godog" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + hyperfoilv1alpha2 "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/api/hyperfoil/v1alpha2" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/installers" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" ) const ( diff --git a/bddframework/pkg/steps/image_registry.go b/bddframework/pkg/steps/image_registry.go index 444c70cd9..8ad03fb3f 100644 --- a/bddframework/pkg/steps/image_registry.go +++ b/bddframework/pkg/steps/image_registry.go @@ -22,6 +22,7 @@ import ( "strings" "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/steps/mappers" diff --git a/bddframework/pkg/steps/infinispan.go b/bddframework/pkg/steps/infinispan.go index e00b511c7..0a0ef4ef3 100644 --- a/bddframework/pkg/steps/infinispan.go +++ b/bddframework/pkg/steps/infinispan.go @@ -18,6 +18,7 @@ import ( infinispan "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/infinispan/v1" "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/installers" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/steps/mappers" diff --git a/bddframework/pkg/steps/kafka.go b/bddframework/pkg/steps/kafka.go index 5dcf309b4..65062759a 100644 --- a/bddframework/pkg/steps/kafka.go +++ b/bddframework/pkg/steps/kafka.go @@ -16,12 +16,13 @@ package steps import ( "github.com/cucumber/godog" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/kafka/v1beta2" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/installers" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) func registerKafkaSteps(ctx *godog.ScenarioContext, data *Data) { diff --git a/bddframework/pkg/steps/keycloak.go b/bddframework/pkg/steps/keycloak.go index af8091b2e..90c08b056 100644 --- a/bddframework/pkg/steps/keycloak.go +++ b/bddframework/pkg/steps/keycloak.go @@ -16,6 +16,7 @@ package steps import ( "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/installers" ) diff --git a/bddframework/pkg/steps/knative-eventing-kogito.go b/bddframework/pkg/steps/knative-eventing-kogito.go index 4dc8ead0f..fab07578a 100644 --- a/bddframework/pkg/steps/knative-eventing-kogito.go +++ b/bddframework/pkg/steps/knative-eventing-kogito.go @@ -16,7 +16,9 @@ package steps import ( "fmt" + "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/installers" ) diff --git a/bddframework/pkg/steps/knative.go b/bddframework/pkg/steps/knative.go index d603c6249..9525c0ff8 100644 --- a/bddframework/pkg/steps/knative.go +++ b/bddframework/pkg/steps/knative.go @@ -16,12 +16,13 @@ package steps import ( "github.com/cucumber/godog" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/installers" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" + + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/installers" ) func registerKnativeSteps(ctx *godog.ScenarioContext, data *Data) { diff --git a/bddframework/pkg/steps/kogitodataindex.go b/bddframework/pkg/steps/kogitodataindex.go index 42950d9ed..7c29d97fc 100644 --- a/bddframework/pkg/steps/kogitodataindex.go +++ b/bddframework/pkg/steps/kogitodataindex.go @@ -16,6 +16,7 @@ package steps import ( "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure" diff --git a/bddframework/pkg/steps/kogitojobsservice.go b/bddframework/pkg/steps/kogitojobsservice.go index 2a9864f65..95cbfe7a7 100644 --- a/bddframework/pkg/steps/kogitojobsservice.go +++ b/bddframework/pkg/steps/kogitojobsservice.go @@ -16,6 +16,7 @@ package steps import ( "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure" diff --git a/bddframework/pkg/steps/kogitomgmtconsole.go b/bddframework/pkg/steps/kogitomgmtconsole.go index dd5707287..74465ace1 100644 --- a/bddframework/pkg/steps/kogitomgmtconsole.go +++ b/bddframework/pkg/steps/kogitomgmtconsole.go @@ -16,6 +16,7 @@ package steps import ( "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/steps/mappers" bddtypes "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/types" diff --git a/bddframework/pkg/steps/kogitotaskconsole.go b/bddframework/pkg/steps/kogitotaskconsole.go index a96660629..707f52de1 100644 --- a/bddframework/pkg/steps/kogitotaskconsole.go +++ b/bddframework/pkg/steps/kogitotaskconsole.go @@ -16,6 +16,7 @@ package steps import ( "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/steps/mappers" bddtypes "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/types" diff --git a/bddframework/pkg/steps/kubernetes.go b/bddframework/pkg/steps/kubernetes.go index 68dc0ed9a..9b187f679 100644 --- a/bddframework/pkg/steps/kubernetes.go +++ b/bddframework/pkg/steps/kubernetes.go @@ -16,9 +16,10 @@ package steps import ( "github.com/cucumber/godog" + v1 "k8s.io/api/core/v1" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/steps/mappers" - v1 "k8s.io/api/core/v1" ) /* diff --git a/bddframework/pkg/steps/maven.go b/bddframework/pkg/steps/maven.go index 735c54326..e78c93efc 100644 --- a/bddframework/pkg/steps/maven.go +++ b/bddframework/pkg/steps/maven.go @@ -16,6 +16,7 @@ package steps import ( "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/steps/mappers" ) diff --git a/bddframework/pkg/steps/mongodb.go b/bddframework/pkg/steps/mongodb.go index ca75afb7e..623c43315 100644 --- a/bddframework/pkg/steps/mongodb.go +++ b/bddframework/pkg/steps/mongodb.go @@ -16,6 +16,7 @@ package steps import ( "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/installers" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/steps/mappers" diff --git a/bddframework/pkg/steps/openshift.go b/bddframework/pkg/steps/openshift.go index 484aa36ff..9ee8131bd 100644 --- a/bddframework/pkg/steps/openshift.go +++ b/bddframework/pkg/steps/openshift.go @@ -18,9 +18,10 @@ import ( "fmt" "github.com/cucumber/godog" + v1 "k8s.io/api/core/v1" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/steps/mappers" - v1 "k8s.io/api/core/v1" ) const defaultTimeoutToStartBuildInMin = 5 diff --git a/bddframework/pkg/steps/postgresql.go b/bddframework/pkg/steps/postgresql.go index a64bf2189..7b65fd94a 100644 --- a/bddframework/pkg/steps/postgresql.go +++ b/bddframework/pkg/steps/postgresql.go @@ -16,6 +16,7 @@ package steps import ( "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/steps/mappers" ) diff --git a/bddframework/pkg/steps/process.go b/bddframework/pkg/steps/process.go index 3ff97b5d0..f6ee42f98 100644 --- a/bddframework/pkg/steps/process.go +++ b/bddframework/pkg/steps/process.go @@ -18,6 +18,7 @@ import ( "fmt" "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" ) diff --git a/bddframework/pkg/steps/prometheus.go b/bddframework/pkg/steps/prometheus.go index 42bd712c2..ef9014e43 100644 --- a/bddframework/pkg/steps/prometheus.go +++ b/bddframework/pkg/steps/prometheus.go @@ -16,6 +16,7 @@ package steps import ( "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/installers" ) diff --git a/bddframework/pkg/steps/task.go b/bddframework/pkg/steps/task.go index a1f822585..a2b372946 100644 --- a/bddframework/pkg/steps/task.go +++ b/bddframework/pkg/steps/task.go @@ -18,6 +18,7 @@ import ( "fmt" "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" ) diff --git a/controllers/workflowdef/image.go b/controllers/workflowdef/image.go index 4ff8bf76a..1eba4ac17 100644 --- a/controllers/workflowdef/image.go +++ b/controllers/workflowdef/image.go @@ -25,6 +25,7 @@ const ( nightlySuffix = "nightly" defaultWorkflowDevModeImage = "quay.io/kiegroup/kogito-swf-devmode" defaultWorkflowBuilderImage = "quay.io/kiegroup/kogito-swf-builder" + defaultOperatorImage = "quay.io/kiegroup/kogito-serverless-operator" ) // GetWorkflowAppImageNameTag retrieve the tag for the image based on the Workflow based annotation, :latest otherwise @@ -44,6 +45,10 @@ func GetDefaultWorkflowBuilderImageTag() string { return GetDefaultImageTag(defaultWorkflowBuilderImage) } +func GetDefaultOperatorImageTag() string { + return GetDefaultImageTag(defaultOperatorImage) +} + func GetDefaultImageTag(imgTag string) string { if version.IsSnapshot() { imgTag += "-" + nightlySuffix diff --git a/hack/addheaders.sh b/hack/addheaders.sh index 9dac480b9..13934c16c 100755 --- a/hack/addheaders.sh +++ b/hack/addheaders.sh @@ -18,4 +18,4 @@ if ! hash addlicense 2>/dev/null; then fi # shellcheck disable=SC2035 -addlicense -c "Red Hat, Inc. and/or its affiliates" -l=apache -ignore=test/samples/*.yaml -ignore=container-builder/examples/**/*.yaml Dockerfile hack api controllers utils test testbdd container-builder workflowproj +addlicense -c "Red Hat, Inc. and/or its affiliates" -l=apache -ignore=test/samples/*.yaml -ignore=container-builder/examples/**/*.yaml Dockerfile hack api bddframework controllers utils test testbdd container-builder workflowproj diff --git a/hack/run-tests.sh b/hack/run-tests.sh index 749b6df43..3089ea02d 100755 --- a/hack/run-tests.sh +++ b/hack/run-tests.sh @@ -74,7 +74,7 @@ function usage(){ printf "\n-h | --help\n\tPrint the usage of this script." # tests configuration - printf "\n--test_main_dir {TEST_MAIN_DIR}\n\tWhere to find the `main_test.go` file. Default to `{kogito_operator}/test/`." + printf "\n--test_main_dir {TEST_MAIN_DIR}\n\tWhere to find the `main_test.go` file. Default to `testbdd/`." printf "\n--feature {FEATURE_PATH}\n\tRun a specific feature file." printf "\n--tags {TAGS}\n\tFilter scenarios by tags." printf "\n\tExpressions can be:" @@ -91,7 +91,8 @@ function usage(){ printf "\n--load_factor {INT_VALUE}\n\tSet the tests load factor. Useful for the tests to take into account that the cluster can be overloaded, for example for the calculation of timeouts. Default value is 1." printf "\n--ci {CI_NAME}\n\tSpecify whether you run test with ci, give also the name of the CI." printf "\n--cr_deployment_only\n\tUse this option if you have no CLI to test against. It will use only direct CR deployments." - printf "\n--load_default_config\n\tTo be used if you want to directly use the default test config contained into ${SCRIPT_DIR}/../test/.default_config" + printf "\n--load_default_config\n\tTo be used if you want to directly use the default test config contained into ${SCRIPT_DIR}/../testbdd/.default_config" + printf "\n--format\n\tFormat to use for Godog output, possible values are 'pretty' or 'junit' (default)" printf "\n--container_engine\n\tTo be used if you want to specify engine to interact with images and containers. Default is docker." printf "\n--domain_suffix\n\tTo be used if you want to set a domain suffix for exposed services. Ignored when running tests on Openshift." printf "\n--image_cache_mode\n\tUse this option to specify whether you want to use image cache for runtime images. Available options are 'always', 'never' or 'if-available'(default)." @@ -214,7 +215,7 @@ TIMEOUT=240 DEBUG=false KEEP_NAMESPACE=false LOAD_DEFAULT_CONFIG=false -TEST_MAIN_DIR=${SCRIPT_DIR}/../test +TEST_MAIN_DIR=${SCRIPT_DIR}/../testbdd ENABLE_CLEAN_CLUSTER=false while (( $# )) @@ -287,6 +288,10 @@ case $1 in LOAD_DEFAULT_CONFIG=true fi ;; + --format) + shift + if addParamKeyValueIfAccepted "--godog.format" ${1}; then shift; fi + ;; # dev options --dry_run) @@ -362,13 +367,13 @@ done # load test default config options if not set already if [ "${LOAD_DEFAULT_CONFIG}" = "true" ]; then echo "Load default test config" - cat "${SCRIPT_DIR}/../test/.default_config" + cat "${SCRIPT_DIR}/../testbdd/.default_config" while IFS="=" read -r key value do if [[ $PARAMS != *"${key}"* ]]; then addParam "--${key}=${value}" fi - done < "${SCRIPT_DIR}/../test/.default_config" + done < "${SCRIPT_DIR}/../testbdd/.default_config" fi ## Clean cluster before executing the tests @@ -387,13 +392,13 @@ echo "Tests finished with code ${exit_code}" if [ "${KEEP_NAMESPACE}" = "false" ]; then echo "-------- Pruning namespaces" - cd ${SCRIPT_DIR}/../test + cd ${SCRIPT_DIR}/../testbdd go run scripts/prune_namespaces.go echo "Pruning namespaces done." - cd - + cd - >/dev/null fi -echo "-------- Delete stucked namespaces" +echo "-------- Delete stuck namespaces" ${SCRIPT_DIR}/clean-stuck-namespaces.sh if [ "${KEEP_NAMESPACE}" = "false" ] && [ "${ENABLE_CLEAN_CLUSTER}" = "true" ]; then diff --git a/testbdd/Makefile b/testbdd/Makefile new file mode 100644 index 000000000..32e549e16 --- /dev/null +++ b/testbdd/Makefile @@ -0,0 +1,26 @@ +TEST_PARAMS=$(foreach V,$(.VARIABLES),$(if $(filter command line, $(origin $V)),--$(V) "$($(V))")) + +.PHONY: fmt +fmt: ## Run go fmt against code. + go mod tidy + go fmt ./... + +.PHONY: vet +vet: ## Run go vet against code. + go vet ./... + +.PHONY: update-modules +update-modules: fmt vet + +.PHONY: run-tests +run-tests: update-modules + ../hack/run-tests.sh $(TEST_PARAMS) + +.PHONY: run-smoke-tests +run-smoke-tests: update-modules + $(MAKE) run-tests smoke=true + +.PHONY: clean-logs +clean-logs: + rm -rf logs/ + diff --git a/testbdd/executor/bdd_executor.go b/testbdd/executor/bdd_executor.go index d557d9e85..ecf3cfbae 100644 --- a/testbdd/executor/bdd_executor.go +++ b/testbdd/executor/bdd_executor.go @@ -17,24 +17,26 @@ package executor import ( "context" "fmt" - "github.com/kiegroup/kogito-serverless-operator/testbdd/installers" - "github.com/kiegroup/kogito-serverless-operator/testbdd/steps" "io" "os" "strings" "time" + "github.com/kiegroup/kogito-serverless-operator/testbdd/installers" + "github.com/kiegroup/kogito-serverless-operator/testbdd/steps" + "github.com/cucumber/godog" "github.com/cucumber/godog/colors" "github.com/cucumber/messages-go/v16" + imgv1 "github.com/openshift/api/image/v1" + olmapiv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + flag "github.com/spf13/pflag" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/gherkin" frameworkInstallers "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/installers" kogitoSteps "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/steps" - imgv1 "github.com/openshift/api/image/v1" - olmapiv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" - flag "github.com/spf13/pflag" ) const ( diff --git a/testbdd/features/e2e.feature b/testbdd/features/e2e.feature index bf19c29d7..6a2fb80a4 100644 --- a/testbdd/features/e2e.feature +++ b/testbdd/features/e2e.feature @@ -1,12 +1,12 @@ Feature: Deploy SonataFlow Operator @devMode - Scenario: order-processing E2E test + Scenario: order-processing DevMode E2E test Given Namespace is created When SonataFlow Operator is deployed When SonataFlowPlatform is deployed When SonataFlow orderprocessing example is deployed - Then SonataFlow "orderprocessing" has the condition "Running" set to "True" within 1 minutes + Then SonataFlow "orderprocessing" has the condition "Running" set to "True" within 2 minutes Then SonataFlow "orderprocessing" is addressable within 1 minute Then HTTP POST request as Cloud Event on SonataFlow "orderprocessing" is successful within 1 minute with path "", headers "content-type= application/json,ce-specversion= 1.0,ce-source= /from/localhost,ce-type= orderEvent,ce-id= f0643c68-609c-48aa-a820-5df423fa4fe0" and body: """json diff --git a/testbdd/framework/operator.go b/testbdd/framework/operator.go index 3cb995e6f..b49915f92 100644 --- a/testbdd/framework/operator.go +++ b/testbdd/framework/operator.go @@ -16,10 +16,12 @@ package framework import ( "fmt" - framework "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/operator" + v1 "k8s.io/api/apps/v1" "k8s.io/apimachinery/pkg/types" + + framework "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/operator" ) const ( diff --git a/testbdd/go.mod b/testbdd/go.mod index 4472172f0..2deca91ef 100644 --- a/testbdd/go.mod +++ b/testbdd/go.mod @@ -7,7 +7,6 @@ replace ( github.com/kiegroup/kogito-serverless-operator/api => ../api github.com/kiegroup/kogito-serverless-operator/bddframework => ../bddframework github.com/kiegroup/kogito-serverless-operator/container-builder => ../container-builder - github.com/kiegroup/kogito-serverless-operator/workflowproj => ../workflowproj github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring => github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.50.0 ) @@ -46,6 +45,7 @@ require ( github.com/evanphx/json-patch v5.6.0+incompatible // indirect github.com/evanphx/json-patch/v5 v5.6.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/ghodss/yaml v1.0.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-logr/logr v1.2.4 // indirect @@ -76,6 +76,7 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/kelseyhightower/envconfig v1.4.0 // indirect github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd // indirect + github.com/kiegroup/kogito-serverless-operator/container-builder v0.0.0 // indirect github.com/leodido/go-urn v1.2.1 // indirect github.com/machinebox/graphql v0.2.2 // indirect github.com/mailru/easyjson v0.7.7 // indirect diff --git a/testbdd/go.sum b/testbdd/go.sum index f36883cf0..ada0f2dc2 100644 --- a/testbdd/go.sum +++ b/testbdd/go.sum @@ -304,6 +304,7 @@ github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbS github.com/fsouza/fake-gcs-server v1.7.0/go.mod h1:5XIRs4YvwNbNoz+1JF8j6KLAyDh7RHGAyAK3EP2EsNk= github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= diff --git a/testbdd/installers/sonataflow_installer.go b/testbdd/installers/sonataflow_installer.go index 71123814f..11b20c78d 100644 --- a/testbdd/installers/sonataflow_installer.go +++ b/testbdd/installers/sonataflow_installer.go @@ -17,13 +17,14 @@ package installers import ( "errors" "fmt" - "github.com/kiegroup/kogito-serverless-operator/version" "regexp" + "sigs.k8s.io/controller-runtime/pkg/client" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/installers" + "github.com/kiegroup/kogito-serverless-operator/controllers/workflowdef" srvframework "github.com/kiegroup/kogito-serverless-operator/testbdd/framework" ) @@ -95,7 +96,7 @@ func installSonataFlowUsingYaml() error { return err } - regexp, err := regexp.Compile("quay.io/kiegroup/kogito-serverless-operator-nightly.*" + ":" + version.OperatorVersion) // TODO use version/version.go from this repository + regexp, err := regexp.Compile(workflowdef.GetDefaultOperatorImageTag()) if err != nil { return err } diff --git a/testbdd/meta/meta.go b/testbdd/meta/meta.go index cf7c1d4b3..84c7d9681 100644 --- a/testbdd/meta/meta.go +++ b/testbdd/meta/meta.go @@ -15,13 +15,6 @@ package meta import ( - sonata "github.com/kiegroup/kogito-serverless-operator/api/v1alpha08" - hyperfoil "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/api/hyperfoil/v1alpha2" - grafana "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/grafana/v1alpha1" - infinispan "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/infinispan/v1" - kafka "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/kafka/v1beta2" - keycloak "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/keycloak/v1alpha1" - mongodb "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/mongodb/v1" appsv1 "github.com/openshift/api/apps/v1" buildv1 "github.com/openshift/api/build/v1" imgv1 "github.com/openshift/api/image/v1" @@ -32,6 +25,14 @@ import ( eventing "knative.dev/eventing/pkg/apis/eventing/v1" sources "knative.dev/eventing/pkg/apis/sources/v1" + sonata "github.com/kiegroup/kogito-serverless-operator/api/v1alpha08" + hyperfoil "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/api/hyperfoil/v1alpha2" + grafana "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/grafana/v1alpha1" + infinispan "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/infinispan/v1" + kafka "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/kafka/v1beta2" + keycloak "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/keycloak/v1alpha1" + mongodb "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework/infrastructure/mongodb/v1" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" diff --git a/bddframework/scripts/prune_namespaces.go b/testbdd/scripts/prune_namespaces.go similarity index 56% rename from bddframework/scripts/prune_namespaces.go rename to testbdd/scripts/prune_namespaces.go index 4a53ca92b..940608641 100644 --- a/bddframework/scripts/prune_namespaces.go +++ b/testbdd/scripts/prune_namespaces.go @@ -1,4 +1,4 @@ -// Copyright 2020 Red Hat, Inc. and/or its affiliates +// Copyright 2023 Red Hat, Inc. and/or its affiliates // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,24 +16,10 @@ package main import ( "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" - "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/meta" ) func main() { - // Create kube client - if err := framework.InitKubeClient(meta.GetRegisteredSchema()); err != nil { + if err := framework.PruneNamespaces(); err != nil { panic(err) } - - namespaces := framework.GetNamespacesInHistory() - for _, namespace := range namespaces { - if len(namespace) > 0 { - err := framework.DeleteNamespace(namespace) - if err != nil { - framework.GetMainLogger().Error(err, "Error in deleting namespace") - } - } - } - - framework.ClearNamespaceHistory() } diff --git a/testbdd/steps/data.go b/testbdd/steps/data.go index b7a24ff5d..e5621bd63 100644 --- a/testbdd/steps/data.go +++ b/testbdd/steps/data.go @@ -15,11 +15,13 @@ package steps import ( + "strconv" + "time" + "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" kogitoSteps "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/steps" - "strconv" - "time" ) // Data contains all data needed by Gherkin steps to run diff --git a/testbdd/steps/kubernetes.go b/testbdd/steps/kubernetes.go index 0acafad07..12305416f 100644 --- a/testbdd/steps/kubernetes.go +++ b/testbdd/steps/kubernetes.go @@ -16,6 +16,7 @@ package steps import ( "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" ) diff --git a/testbdd/steps/operator.go b/testbdd/steps/operator.go index 9d165750f..b4a8dda3b 100644 --- a/testbdd/steps/operator.go +++ b/testbdd/steps/operator.go @@ -16,7 +16,9 @@ package steps import ( "fmt" + "github.com/cucumber/godog" + "github.com/kiegroup/kogito-serverless-operator/testbdd/installers" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/config" diff --git a/testbdd/steps/sonataflow.go b/testbdd/steps/sonataflow.go index 37ba5603b..020d32ac9 100644 --- a/testbdd/steps/sonataflow.go +++ b/testbdd/steps/sonataflow.go @@ -16,17 +16,19 @@ package steps import ( "fmt" + "net/url" + "path/filepath" + "strings" + "github.com/cucumber/godog" + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/types" + "github.com/kiegroup/kogito-serverless-operator/api" "github.com/kiegroup/kogito-serverless-operator/api/v1alpha08" "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/test" "github.com/kiegroup/kogito-serverless-operator/test/utils" - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/types" - "net/url" - "path/filepath" - "strings" ) func registerSonataFlowSteps(ctx *godog.ScenarioContext, data *Data) { diff --git a/testbdd/steps/sonataflowplatform.go b/testbdd/steps/sonataflowplatform.go index 6cc8f2679..e58fcb9ca 100644 --- a/testbdd/steps/sonataflowplatform.go +++ b/testbdd/steps/sonataflowplatform.go @@ -16,12 +16,15 @@ package steps import ( "fmt" + "path/filepath" + "strings" + "github.com/cucumber/godog" + framework "github.com/kiegroup/kogito-serverless-operator/bddframework/pkg/framework" "github.com/kiegroup/kogito-serverless-operator/test" "github.com/kiegroup/kogito-serverless-operator/test/utils" - "path/filepath" - "strings" + //"github.com/kiegroup/kogito-serverless-operator/test" "os" )