From 4e90204ce4d3b5e9ffbd64fd37122106abe7b361 Mon Sep 17 00:00:00 2001 From: Jonathan West Date: Thu, 22 Feb 2024 03:45:00 -0500 Subject: [PATCH] Update --- controllers/argocd_metrics_controller_test.go | 7 +- controllers/gitopsservice_controller_test.go | 3 +- go.mod | 4 +- go.sum | 4 +- scripts/openshiftci-presubmit-all-tests.sh | 35 +++++++++- scripts/run-kuttl-tests.sh | 68 ++++++++++++------- 6 files changed, 88 insertions(+), 33 deletions(-) diff --git a/controllers/argocd_metrics_controller_test.go b/controllers/argocd_metrics_controller_test.go index fe9deee3b..67b9e3866 100644 --- a/controllers/argocd_metrics_controller_test.go +++ b/controllers/argocd_metrics_controller_test.go @@ -30,7 +30,6 @@ import ( corev1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes/scheme" @@ -54,12 +53,12 @@ const ( func newClient(s *runtime.Scheme, namespace, name string) client.Client { ns := corev1.Namespace{ - ObjectMeta: v1.ObjectMeta{ + ObjectMeta: metav1.ObjectMeta{ Name: namespace, }, } argocd := argoapp.ArgoCD{ - ObjectMeta: v1.ObjectMeta{ + ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, }, @@ -295,7 +294,7 @@ func TestReconciler_add_dashboard(t *testing.T) { // Need to create openshift-config-managed namespace for dashboards ns := corev1.Namespace{ - ObjectMeta: v1.ObjectMeta{ + ObjectMeta: metav1.ObjectMeta{ Name: dashboardNamespace, }, } diff --git a/controllers/gitopsservice_controller_test.go b/controllers/gitopsservice_controller_test.go index 84ccfd675..3725644a8 100644 --- a/controllers/gitopsservice_controller_test.go +++ b/controllers/gitopsservice_controller_test.go @@ -38,7 +38,6 @@ import ( "k8s.io/apimachinery/pkg/api/errors" resourcev1 "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes/scheme" @@ -499,7 +498,7 @@ func TestReconcile_testArgoCDForOperatorUpgrade(t *testing.T) { // Create a basic ArgoCD CR. ArgoCD created by Operator version >= v1.6.0 existingArgoCD := &argoapp.ArgoCD{ - ObjectMeta: v1.ObjectMeta{ + ObjectMeta: metav1.ObjectMeta{ Name: serviceNamespace, Namespace: serviceNamespace, }, diff --git a/go.mod b/go.mod index 292610263..835d551a2 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/redhat-developer/gitops-operator go 1.21 require ( - github.com/argoproj-labs/argo-rollouts-manager v0.0.2 + github.com/argoproj-labs/argo-rollouts-manager v0.0.2-0.20240221054348-027faa92ffdb github.com/argoproj-labs/argocd-operator v0.10.0 github.com/coreos/prometheus-operator v0.40.0 github.com/go-logr/logr v1.4.1 @@ -126,3 +126,5 @@ replace ( k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.28.3 k8s.io/sample-controller => k8s.io/sample-controller v0.28.3 ) + +// replace github.com/argoproj-labs/argo-rollouts-manager => ../argo-rollouts-manager diff --git a/go.sum b/go.sum index 39dc09292..5e77818f9 100644 --- a/go.sum +++ b/go.sum @@ -637,8 +637,8 @@ github.com/apache/arrow/go/v11 v11.0.0/go.mod h1:Eg5OsL5H+e299f7u5ssuXsuHQVEGC4x github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU= -github.com/argoproj-labs/argo-rollouts-manager v0.0.2 h1:f7V6PP1J9vkhYNsMbCWwB4hHqqgJvs+IbT2RFLsn9ho= -github.com/argoproj-labs/argo-rollouts-manager v0.0.2/go.mod h1:r6/vgsXjS3ZdzfrP8QyDHtoFoKXLbVUIndkPeMzHJGc= +github.com/argoproj-labs/argo-rollouts-manager v0.0.2-0.20240221054348-027faa92ffdb h1:Tza/PynlSFFI4twCW1INWjzU8aCjYMJ0mtoQLQGMsrY= +github.com/argoproj-labs/argo-rollouts-manager v0.0.2-0.20240221054348-027faa92ffdb/go.mod h1:r6/vgsXjS3ZdzfrP8QyDHtoFoKXLbVUIndkPeMzHJGc= github.com/argoproj-labs/argocd-operator v0.10.0 h1:B2k6Rwiff3O7fG3K7nNiFuo9TV7Kr0s/K9f4Mo+5Qak= github.com/argoproj-labs/argocd-operator v0.10.0/go.mod h1:4TThdvK88j46P6ybACEhHHqJstdnF+CFHkmlS068dqk= github.com/argoproj/argo-cd/v2 v2.10.1 h1:VD06GPeoq14Bo7IfiW+EKim3T1C9xaMElVrEtw+zll0= diff --git a/scripts/openshiftci-presubmit-all-tests.sh b/scripts/openshiftci-presubmit-all-tests.sh index ab2ee570c..efba426f0 100755 --- a/scripts/openshiftci-presubmit-all-tests.sh +++ b/scripts/openshiftci-presubmit-all-tests.sh @@ -25,4 +25,37 @@ chmod 640 $TMP_DIR/kubeconfig export KUBECONFIG=$TMP_DIR/kubeconfig # Run e2e test -make test-e2e + +# source $(dirname $0)/e2e-common.sh + +# # Ensuring proper installation +# pod=openshift-gitops-operator-controller-manager && oc get pods `oc get pods --all-namespaces | grep $pod | head -1 | awk '{print $2}'` -n openshift-gitops-operator -o yaml + +# subscription=gitops-operator- && oc get subscription `oc get subscription --all-namespaces | grep $subscription | head -1 | awk '{print $2}'` -n openshift-gitops-operator + +# oc wait --for=condition=Ready -n openshift-gitops pod --timeout=15m -l 'app.kubernetes.io/name in (cluster,kam,openshift-gitops-application-controller,openshift-gitops-applicationset-controller,openshift-gitops-dex-server,openshift-gitops-redis,openshift-gitops-repo-server,openshift-gitops-server)' + + + + + +# ROLLOUTS_TMP_DIR=$(mktemp -d) + +# cd $ROLLOUTS_TMP_DIR + +# kubectl get namespaces + +# kubectl get pods -A || true + +# kubectl api-resources + +# git clone https://github.com/argoproj-labs/argo-rollouts-manager + +# cd "$ROLLOUTS_TMP_DIR/argo-rollouts-manager" + +# TARGET_ROLLOUT_MANAGER_COMMIT=027faa92ffdbc43a02eca3982f020a8c391fd340 + +# git checkout $TARGET_ROLLOUT_MANAGER_COMMIT + +# make install generate fmt vet +make test-e2e \ No newline at end of file diff --git a/scripts/run-kuttl-tests.sh b/scripts/run-kuttl-tests.sh index 8af2ab90e..057995829 100755 --- a/scripts/run-kuttl-tests.sh +++ b/scripts/run-kuttl-tests.sh @@ -109,27 +109,49 @@ trap cleanup EXIT # Handle ctrl+c trap unexpectedError INT -mkdir -p $WORK_DIR/results || exit 1 -mkdir -p $DIR/results || exit 1 - -case "$testsuite" in -"parallel") - header "Running $testsuite tests" - run_parallel $2 - ;; -"sequential") - header "Running $testsuite tests" - run_sequential $2 - ;; -"all") - header "Running $testsuite tests" - run_parallel - run_sequential - ;; -*) - echo "USAGE: $0 (parallel|sequential|all)" >&2 - exit 1 -esac -(( failed )) && fail_test "$testsuite tests failed" -success $testsuite + +ROLLOUTS_TMP_DIR=$(mktemp -d) + +cd $ROLLOUTS_TMP_DIR + +kubectl get namespaces + +kubectl get pods -A || true + +kubectl api-resources + +git clone https://github.com/argoproj-labs/argo-rollouts-manager + +cd "$ROLLOUTS_TMP_DIR/argo-rollouts-manager" + +TARGET_ROLLOUT_MANAGER_COMMIT=027faa92ffdbc43a02eca3982f020a8c391fd340 + +git checkout $TARGET_ROLLOUT_MANAGER_COMMIT +make test-e2e + + +# mkdir -p $WORK_DIR/results || exit 1 +# mkdir -p $DIR/results || exit 1 + +# case "$testsuite" in +# "parallel") +# header "Running $testsuite tests" +# run_parallel $2 +# ;; +# "sequential") +# header "Running $testsuite tests" +# run_sequential $2 +# ;; +# "all") +# header "Running $testsuite tests" +# run_parallel +# run_sequential +# ;; +# *) +# echo "USAGE: $0 (parallel|sequential|all)" >&2 +# exit 1 +# esac + +# (( failed )) && fail_test "$testsuite tests failed" +# success $testsuite