mirror of
https://github.com/1Password/onepassword-operator.git
synced 2025-10-22 07:28:06 +00:00
Move BuildOperatorImage
function to testhelper.operator
package
This commit is contained in:
@@ -15,20 +15,15 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
operatorImage = "1password/onepassword-operator:latest"
|
operatorImageName = "1password/onepassword-operator:latest"
|
||||||
defaultInterval = 1 * time.Second
|
defaultInterval = 1 * time.Second
|
||||||
defaultTimeout = 30 * time.Second
|
defaultTimeout = 30 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Onepassword Operator e2e", Ordered, func() {
|
var _ = Describe("Onepassword Operator e2e", Ordered, func() {
|
||||||
BeforeAll(func() {
|
BeforeAll(func() {
|
||||||
By("building the operator image")
|
operator.BuildOperatorImage()
|
||||||
_, err := cmd.Run("make", "docker-build")
|
kind.LoadImageToKind(operatorImageName)
|
||||||
ExpectWithOffset(1, err).NotTo(HaveOccurred())
|
|
||||||
|
|
||||||
By("loading the operator image on Kind")
|
|
||||||
err = kind.LoadImageToKind(operatorImage)
|
|
||||||
ExpectWithOffset(1, err).NotTo(HaveOccurred())
|
|
||||||
|
|
||||||
By("create onepassword-token secret")
|
By("create onepassword-token secret")
|
||||||
kube.CreateSecretFromEnvVar("OP_CONNECT_TOKEN", "onepassword-token")
|
kube.CreateSecretFromEnvVar("OP_CONNECT_TOKEN", "onepassword-token")
|
||||||
|
@@ -3,15 +3,19 @@ package kind
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
. "github.com/onsi/ginkgo/v2"
|
||||||
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"github.com/1Password/onepassword-operator/test/cmd"
|
"github.com/1Password/onepassword-operator/test/cmd"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LoadImageToKind loads a local docker image to the Kind cluster
|
// LoadImageToKind loads a local docker image to the Kind cluster
|
||||||
func LoadImageToKind(imageName string) error {
|
func LoadImageToKind(imageName string) {
|
||||||
|
By("loading the operator image on Kind")
|
||||||
clusterName := "kind"
|
clusterName := "kind"
|
||||||
if value, ok := os.LookupEnv("KIND_CLUSTER"); ok {
|
if value, ok := os.LookupEnv("KIND_CLUSTER"); ok {
|
||||||
clusterName = value
|
clusterName = value
|
||||||
}
|
}
|
||||||
_, err := cmd.Run("kind", "load", "docker-image", imageName, "--name", clusterName)
|
_, err := cmd.Run("kind", "load", "docker-image", imageName, "--name", clusterName)
|
||||||
return err
|
Expect(err).NotTo(HaveOccurred())
|
||||||
}
|
}
|
||||||
|
@@ -10,6 +10,12 @@ import (
|
|||||||
"github.com/1Password/onepassword-operator/test/testhelper/kube"
|
"github.com/1Password/onepassword-operator/test/testhelper/kube"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func BuildOperatorImage() {
|
||||||
|
By("building the operator image")
|
||||||
|
_, err := cmd.Run("make", "docker-build")
|
||||||
|
ExpectWithOffset(1, err).NotTo(HaveOccurred())
|
||||||
|
}
|
||||||
|
|
||||||
// DeployOperator deploys the Onepassword Operator in the default namespace.
|
// DeployOperator deploys the Onepassword Operator in the default namespace.
|
||||||
// It waits for the operator pod to be in 'Running' state.
|
// It waits for the operator pod to be in 'Running' state.
|
||||||
// All the resources created using manifests in `config/` dir.
|
// All the resources created using manifests in `config/` dir.
|
||||||
|
Reference in New Issue
Block a user