mirror of
https://github.com/prometheus-operator/prometheus-operator.git
synced 2025-04-21 03:38:43 +00:00
Move framework so that paths can be shared.
Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
This commit is contained in:
parent
c3f957d2ab
commit
03e1747254
24 changed files with 13 additions and 13 deletions
Makefile
test
e2e
framework
alertmanager.gocluster_role.gocluster_role_binding.gocontext.godeployment.goframework.gohelpers.goingress.gonamespace.goprometheus.goreplication-controller.go
ressources
default-http-backend-service.ymldefault-http-backend.ymlnxginx-ingress-controller.ymlprometheus-role-binding.yml
role-binding.goservice.goservice_account.gothird_party_ressource.gomigration
2
Makefile
2
Makefile
|
@ -29,7 +29,7 @@ container:
|
|||
docker build -t $(REPO):$(TAG) .
|
||||
|
||||
e2e-test:
|
||||
go test -timeout 20m -v ./test/migration/ $(TEST_RUN_ARGS) --kubeconfig "$(HOME)/.kube/config" --operator-image=$(REPO):$(TAG) --namespace=$(NAMESPACE) --cluster-ip=$(CLUSTER_IP)
|
||||
go test -timeout 20m -v ./test/migration/ $(TEST_RUN_ARGS) --kubeconfig=$(KUBECONFIG) --operator-image=$(REPO):$(TAG) --namespace=$(NAMESPACE)
|
||||
go test -timeout 20m -v ./test/e2e/ $(TEST_RUN_ARGS) --kubeconfig=$(KUBECONFIG) --operator-image=$(REPO):$(TAG) --namespace=$(NAMESPACE)
|
||||
|
||||
e2e-status:
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
"k8s.io/client-go/pkg/api/v1"
|
||||
|
||||
"github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1"
|
||||
testFramework "github.com/coreos/prometheus-operator/test/e2e/framework"
|
||||
testFramework "github.com/coreos/prometheus-operator/test/framework"
|
||||
)
|
||||
|
||||
func TestAlertmanagerCreateDeleteCluster(t *testing.T) {
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
operatorFramework "github.com/coreos/prometheus-operator/test/e2e/framework"
|
||||
operatorFramework "github.com/coreos/prometheus-operator/test/framework"
|
||||
)
|
||||
|
||||
var framework *operatorFramework.Framework
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2016 The prometheus-operator Authors
|
||||
/// Copyright 2016 The prometheus-operator Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -33,7 +33,7 @@ import (
|
|||
"github.com/coreos/prometheus-operator/pkg/alertmanager"
|
||||
"github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1"
|
||||
"github.com/coreos/prometheus-operator/pkg/prometheus"
|
||||
testFramework "github.com/coreos/prometheus-operator/test/e2e/framework"
|
||||
testFramework "github.com/coreos/prometheus-operator/test/framework"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/fields"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
|
@ -93,19 +94,19 @@ func (f *Framework) Setup(opImage string) error {
|
|||
}
|
||||
|
||||
func (f *Framework) setupPrometheusOperator(opImage string) error {
|
||||
if _, err := CreateServiceAccount(f.KubeClient, f.Namespace.Name, "../../example/rbac/prometheus-operator/prometheus-operator-service-account.yaml"); err != nil {
|
||||
if _, err := CreateServiceAccount(f.KubeClient, f.Namespace.Name, "../../example/rbac/prometheus-operator/prometheus-operator-service-account.yaml"); err != nil && !apierrors.IsAlreadyExists(err) {
|
||||
return errors.Wrap(err, "failed to create prometheus operator service account")
|
||||
}
|
||||
|
||||
if err := CreateClusterRole(f.KubeClient, "../../example/rbac/prometheus-operator/prometheus-operator-cluster-role.yaml"); err != nil {
|
||||
if err := CreateClusterRole(f.KubeClient, "../../example/rbac/prometheus-operator/prometheus-operator-cluster-role.yaml"); err != nil && !apierrors.IsAlreadyExists(err) {
|
||||
return errors.Wrap(err, "failed to create prometheus cluster role")
|
||||
}
|
||||
|
||||
if _, err := CreateClusterRoleBinding(f.KubeClient, f.Namespace.Name, "../../example/rbac/prometheus-operator/prometheus-operator-cluster-role-binding.yaml"); err != nil {
|
||||
if _, err := CreateClusterRoleBinding(f.KubeClient, f.Namespace.Name, "../../example/rbac/prometheus-operator/prometheus-operator-cluster-role-binding.yaml"); err != nil && !apierrors.IsAlreadyExists(err) {
|
||||
return errors.Wrap(err, "failed to create prometheus cluster role binding")
|
||||
}
|
||||
|
||||
if err := CreateClusterRole(f.KubeClient, "../../example/rbac/prometheus/prometheus-cluster-role.yaml"); err != nil {
|
||||
if err := CreateClusterRole(f.KubeClient, "../../example/rbac/prometheus/prometheus-cluster-role.yaml"); err != nil && !apierrors.IsAlreadyExists(err) {
|
||||
return errors.Wrap(err, "failed to create prometheus cluster role")
|
||||
}
|
||||
|
||||
|
@ -156,7 +157,7 @@ func (ctx *TestCtx) SetupPrometheusRBAC(t *testing.T, ns string, kubeClient kube
|
|||
ctx.AddFinalizerFn(finalizerFn)
|
||||
}
|
||||
|
||||
if finalizerFn, err := CreateRoleBinding(kubeClient, ns, "framework/ressources/prometheus-role-binding.yml"); err != nil {
|
||||
if finalizerFn, err := CreateRoleBinding(kubeClient, ns, "../framework/ressources/prometheus-role-binding.yml"); err != nil {
|
||||
t.Fatal(errors.Wrap(err, "failed to create prometheus role binding"))
|
||||
} else {
|
||||
ctx.AddFinalizerFn(finalizerFn)
|
|
@ -10,7 +10,7 @@ import (
|
|||
|
||||
"github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1"
|
||||
"github.com/coreos/prometheus-operator/pkg/k8sutil"
|
||||
operatorFramework "github.com/coreos/prometheus-operator/test/e2e/framework"
|
||||
operatorFramework "github.com/coreos/prometheus-operator/test/framework"
|
||||
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
|
@ -24,7 +24,6 @@ func TestMain(m *testing.M) {
|
|||
kubeconfig = flag.String("kubeconfig", "", "kube config path, e.g. $HOME/.kube/config")
|
||||
opImage = flag.String("operator-image", "", "operator image, e.g. quay.io/coreos/prometheus-operator")
|
||||
ns = flag.String("namespace", "prometheus-operator-e2e-tests", "e2e test namespace")
|
||||
ip = flag.String("cluster-ip", "", "ip of the kubernetes cluster to use for external requests")
|
||||
flag.Parse()
|
||||
|
||||
os.Exit(m.Run())
|
||||
|
@ -68,7 +67,6 @@ func TestMigration(t *testing.T) {
|
|||
*ns,
|
||||
*kubeconfig,
|
||||
"quay.io/coreos/prometheus-operator:v0.10.2",
|
||||
*ip,
|
||||
); err != nil {
|
||||
log.Printf("failed to setup framework: %v\n", err)
|
||||
t.Fatal(err)
|
||||
|
@ -77,6 +75,7 @@ func TestMigration(t *testing.T) {
|
|||
ctx := framework.NewTestCtx(t)
|
||||
defer ctx.Cleanup(t)
|
||||
ns2 := ctx.CreateNamespace(t, framework.KubeClient)
|
||||
ctx.SetupPrometheusRBAC(t, ns2, framework.KubeClient)
|
||||
|
||||
// Launch the objects.
|
||||
name := "test"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue