Skip to content

Commit

Permalink
👷 Add Makefiles and minor polishes ✨
Browse files Browse the repository at this point in the history
  • Loading branch information
MarianMacik committed Oct 3, 2023
1 parent 7251264 commit 511d362
Show file tree
Hide file tree
Showing 104 changed files with 366 additions and 158 deletions.
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions bddframework/Makefile
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions bddframework/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand All @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
3 changes: 2 additions & 1 deletion bddframework/pkg/api/app/v1beta1/kogitoservices.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 1 addition & 3 deletions bddframework/pkg/api/app/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions bddframework/pkg/api/hyperfoil/v1alpha2/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bddframework/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ type TestConfig struct {
}

const (
defaultOperatorYamlURI = "../kogito-operator.yaml"
defaultOperatorYamlURI = "../operator.yaml"
defaultRhpamOperatorYamlURI = "../rhpam-operator.yaml"
defaultCliPath = "../build/_output/bin/kogito"

Expand Down
3 changes: 2 additions & 1 deletion bddframework/pkg/framework/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions bddframework/pkg/framework/client/client_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions bddframework/pkg/framework/client/kubernetes/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package kubernetes

import (
"context"

v1beta1 "k8s.io/api/events/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

Expand Down
3 changes: 2 additions & 1 deletion bddframework/pkg/framework/client/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")}
Expand Down
3 changes: 2 additions & 1 deletion bddframework/pkg/framework/client/kubernetes/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion bddframework/pkg/framework/client/kubernetes/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion bddframework/pkg/framework/client/kubernetes/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion bddframework/pkg/framework/client/test/kubeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
3 changes: 2 additions & 1 deletion bddframework/pkg/framework/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
14 changes: 14 additions & 0 deletions bddframework/pkg/framework/env/env.go
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
1 change: 1 addition & 0 deletions bddframework/pkg/framework/grafana.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package framework

import (
"fmt"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"

Expand Down
3 changes: 2 additions & 1 deletion bddframework/pkg/framework/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down
4 changes: 3 additions & 1 deletion bddframework/pkg/framework/infinispan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions bddframework/pkg/framework/infrastructure/infinispan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 511d362

Please sign in to comment.