Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vCore: numa test suite #69

Merged
merged 5 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/nmstate/kubernetes-nmstate/api v0.0.0-20240605150941-df565dd7bf35
github.com/onsi/ginkgo/v2 v2.19.0
github.com/onsi/gomega v1.33.1
github.com/openshift-kni/eco-goinfra v0.0.0-20240621192821-7c55fda74f32 // release-4.15
github.com/openshift-kni/eco-goinfra v0.0.0-20240626143745-4d019aeb6f02 // release-4.15
github.com/openshift-kni/k8sreporter v1.0.5
github.com/openshift/api v3.9.1-0.20191111211345-a27ff30ebf09+incompatible
github.com/openshift/assisted-service/api v0.0.0
Expand All @@ -44,6 +44,7 @@ require (
github.com/kedacore/keda-olm-operator v0.0.0-20240501182040-762f6be5a942
github.com/kedacore/keda/v2 v2.14.0
github.com/openshift-kni/lifecycle-agent v0.0.0-20240606123201-0c45cd13c2f1
github.com/openshift-kni/numaresources-operator v0.4.16-0rc0
github.com/openshift/client-go v0.0.1
github.com/openshift/installer v0.0.0-00010101000000-000000000000
github.com/povsister/scp v0.0.0-20210427074412-33febfd9f13e
Expand All @@ -70,7 +71,6 @@ require (
github.com/metal3-io/baremetal-operator/pkg/hardwareutils v0.5.1 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/nutanix-cloud-native/prism-go-client v0.2.1-0.20220804130801-c8a253627c64 // indirect
github.com/openshift-kni/numaresources-operator v0.4.16-0rc0 // indirect
github.com/openshift/cluster-logging-operator v0.0.0-20240606085930-750f369019d4 // indirect
github.com/openshift/elasticsearch-operator v0.0.0-20220613183908-e1648e67c298 // indirect
github.com/stmcginnis/gofish v0.15.1-0.20231121142100-22a60a77be91 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1691,8 +1691,8 @@ github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE
github.com/opencontainers/runtime-spec v1.2.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
github.com/openshift-kni/cluster-group-upgrades-operator v0.0.0-20240423171335-f07cdbf8af2c h1:wAPCXsnAXOUAJ5DYlVgGUcV9YBSiVlH4o9tbQ9py8ZY=
github.com/openshift-kni/cluster-group-upgrades-operator v0.0.0-20240423171335-f07cdbf8af2c/go.mod h1:hkzqKpmQvh7vgPx8Hw6IExJorKPM0dEeJdOXjIW3gNw=
github.com/openshift-kni/eco-goinfra v0.0.0-20240621192821-7c55fda74f32 h1:mLsBeu1cSEvCbJ2hEGDqoMA46leC6FD+V0zPLczkEVQ=
github.com/openshift-kni/eco-goinfra v0.0.0-20240621192821-7c55fda74f32/go.mod h1:oGFnQMzZ/bqtnjdh9Rx44NzsMGWaZXgyQsoS0Q7faJ8=
github.com/openshift-kni/eco-goinfra v0.0.0-20240626143745-4d019aeb6f02 h1:e9+xSEmZzymaHJbRsZ+6cndk8TYGYPYdDqVbPTVz0r4=
github.com/openshift-kni/eco-goinfra v0.0.0-20240626143745-4d019aeb6f02/go.mod h1:oGFnQMzZ/bqtnjdh9Rx44NzsMGWaZXgyQsoS0Q7faJ8=
github.com/openshift-kni/k8sreporter v1.0.5 h1:1GYBc/BTZyVoXilHef43v9A8BSzw700zAPZ6zsZvo6Y=
github.com/openshift-kni/k8sreporter v1.0.5/go.mod h1:fg8HI9yxiKAi6UzR6NTtrmQmA2WKzUqmkRUHwQ1+Bj8=
github.com/openshift-kni/lifecycle-agent v0.0.0-20240606123201-0c45cd13c2f1 h1:y+0Ecc+MSZA/GNS3VOpKq+XK9x8qoNA7TlyHvqbVbpw=
Expand Down
4 changes: 2 additions & 2 deletions tests/system-tests/internal/await/await.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ func WaitUntilNodeIsUnreachable(hostname string, timeout time.Duration) error {
}
}

// WaitUntilNewDaemonSetIsRunning waits until the new daemonset is in Ready state.
func WaitUntilNewDaemonSetIsRunning(apiClient *clients.Settings, name, nsname string, timeout time.Duration) error {
// WaitUntilDaemonSetIsRunning waits until the new daemonset is in Ready state.
func WaitUntilDaemonSetIsRunning(apiClient *clients.Settings, name, nsname string, timeout time.Duration) error {
glog.V(90).Infof("Verifying if daemonset %s is running in namespace %s", name, nsname)

var daemonsetObj *daemonset.Builder
Expand Down
120 changes: 120 additions & 0 deletions tests/system-tests/vcore/internal/vcorecommon/helper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package vcorecommon

import (
"context"
"fmt"
"time"

"github.com/golang/glog"
"github.com/onsi/gomega"
"github.com/openshift-kni/eco-goinfra/pkg/namespace"
"github.com/openshift-kni/eco-gotests/tests/system-tests/internal/mirroring"
"github.com/openshift-kni/eco-gotests/tests/system-tests/internal/platform"
"github.com/openshift-kni/eco-gotests/tests/system-tests/vcore/internal/vcoreinittools"
"github.com/openshift-kni/eco-gotests/tests/system-tests/vcore/internal/vcoreparams"
"k8s.io/apimachinery/pkg/util/wait"
)

func getImageURL(repository, name, tag string) (string, error) {
imageURL := fmt.Sprintf("%s/%s", repository, name)

isDisconnected, err := platform.IsDisconnectedDeployment(vcoreinittools.APIClient)

if err != nil {
return "", err
}

if !isDisconnected {
glog.V(vcoreparams.VCoreLogLevel).Info("The connected deployment type was detected, " +
"the images mirroring is not required")
} else {
glog.V(vcoreparams.VCoreLogLevel).Infof("Mirror image %s:%s locally", imageURL, tag)

imageURL, _, err = mirroring.MirrorImageToTheLocalRegistry(
vcoreinittools.APIClient,
repository,
name,
tag,
vcoreinittools.VCoreConfig.Host,
vcoreinittools.VCoreConfig.User,
vcoreinittools.VCoreConfig.Pass,
vcoreinittools.VCoreConfig.CombinedPullSecretFile,
vcoreinittools.VCoreConfig.RegistryRepository)

if err != nil {
return "", fmt.Errorf("failed to mirror image %s:%s locally due to %w",
name, tag, err)
}
}

return fmt.Sprintf("%s:%s", imageURL, tag), nil
}

func insureNamespaceNotExists(nsName string) bool {
watchNamespace := namespace.NewBuilder(vcoreinittools.APIClient, nsName)
if watchNamespace.Exists() {
err := watchNamespace.Delete()
gomega.Expect(err).ToNot(gomega.HaveOccurred(),
fmt.Sprintf("Failed to delete watch namespace %s due to: %v",
vcoreparams.KedaWatchNamespace, err))

err = wait.PollUntilContextTimeout(
context.TODO(),
time.Second,
time.Minute*10,
true,
func(ctx context.Context) (bool, error) {
isExists := watchNamespace.Exists()

if !isExists {
return true, nil
}

return false, nil
})
gomega.Expect(err).ToNot(gomega.HaveOccurred(),
fmt.Sprintf("Failed to delete watch namespace %s due to: %v",
vcoreparams.KedaWatchNamespace, err))
}

return true
}

func insureNamespaceExists(nsName string) bool {
glog.V(vcoreparams.VCoreLogLevel).Infof("Insure namespace %q exists", nsName)

createNs := namespace.NewBuilder(vcoreinittools.APIClient, nsName)

if !createNs.Exists() {
createNs, err := createNs.Create()

if err != nil {
glog.V(vcoreparams.VCoreLogLevel).Infof("Error creating namespace %q: %v", nsName, err)

return false
}

err = wait.PollUntilContextTimeout(
context.TODO(),
time.Second,
3*time.Second,
true,
func(ctx context.Context) (bool, error) {
if !createNs.Exists() {
glog.V(vcoreparams.VCoreLogLevel).Infof("Error creating namespace %q", nsName)

return false, nil
}

glog.V(vcoreparams.VCoreLogLevel).Infof("Created namespace %q", createNs.Definition.Name)

return true, nil
})

if err != nil {
return false
}
}

return true
}
113 changes: 1 addition & 112 deletions tests/system-tests/vcore/internal/vcorecommon/keda-validation.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package vcorecommon

import (
"context"
"fmt"
"os"
"path/filepath"
Expand All @@ -21,21 +20,15 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"

"github.com/openshift-kni/eco-goinfra/pkg/reportxml"
"k8s.io/apimachinery/pkg/util/wait"

"github.com/golang/glog"
kedav1alpha1 "github.com/kedacore/keda-olm-operator/apis/keda/v1alpha1"
kedav2v1alpha1 "github.com/kedacore/keda/v2/apis/keda/v1alpha1"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/openshift-kni/eco-goinfra/pkg/keda"
"github.com/openshift-kni/eco-goinfra/pkg/namespace"
"github.com/openshift-kni/eco-goinfra/pkg/reportxml"
"github.com/openshift-kni/eco-gotests/tests/system-tests/internal/apiobjectshelper"
"github.com/openshift-kni/eco-gotests/tests/system-tests/internal/mirroring"
"github.com/openshift-kni/eco-gotests/tests/system-tests/internal/ocpcli"
"github.com/openshift-kni/eco-gotests/tests/system-tests/internal/platform"

. "github.com/openshift-kni/eco-gotests/tests/system-tests/vcore/internal/vcoreinittools"
"github.com/openshift-kni/eco-gotests/tests/system-tests/vcore/internal/vcoreparams"
)
Expand Down Expand Up @@ -417,107 +410,3 @@ func VerifyScaleObjectDeployment(ctx SpecContext) {
Expect(isCntReached).To(Equal(true), fmt.Sprintf("failed to scale %s pods in namespace %s after %v",
vcoreparams.KedaWatchAppName, vcoreparams.KedaWatchNamespace, time.Minute*5))
} // func VerifyKedaControllerDeployment (ctx SpecContext)

func getImageURL(repository, name, tag string) (string, error) {
imageURL := fmt.Sprintf("%s/%s", repository, name)

isDisconnected, err := platform.IsDisconnectedDeployment(APIClient)

if err != nil {
return "", err
}

if !isDisconnected {
glog.V(vcoreparams.VCoreLogLevel).Info("The connected deployment type was detected, " +
"the images mirroring is not required")
} else {
glog.V(vcoreparams.VCoreLogLevel).Infof("Mirror image %s:%s locally", imageURL, tag)

imageURL, _, err = mirroring.MirrorImageToTheLocalRegistry(
APIClient,
repository,
name,
tag,
VCoreConfig.Host,
VCoreConfig.User,
VCoreConfig.Pass,
VCoreConfig.CombinedPullSecretFile,
VCoreConfig.RegistryRepository)

if err != nil {
return "", fmt.Errorf("failed to mirror image %s:%s locally due to %w",
name, tag, err)
}
}

return fmt.Sprintf("%s:%s", imageURL, tag), nil
}

func insureNamespaceNotExists(nsName string) bool {
watchNamespace := namespace.NewBuilder(APIClient, nsName)
if watchNamespace.Exists() {
err := watchNamespace.Delete()
Expect(err).ToNot(HaveOccurred(),
fmt.Sprintf("Failed to delete watch namespace %s due to: %v",
vcoreparams.KedaWatchNamespace, err))

err = wait.PollUntilContextTimeout(
context.TODO(),
time.Second,
time.Minute*10,
true,
func(ctx context.Context) (bool, error) {
isExists := watchNamespace.Exists()

if !isExists {
return true, nil
}

return false, nil
})
Expect(err).ToNot(HaveOccurred(),
fmt.Sprintf("Failed to delete watch namespace %s due to: %v",
vcoreparams.KedaWatchNamespace, err))
}

return true
}

func insureNamespaceExists(nsName string) bool {
glog.V(vcoreparams.VCoreLogLevel).Infof("Insure namespace %q exists", nsName)

createNs := namespace.NewBuilder(APIClient, nsName)

if !createNs.Exists() {
createNs, err := createNs.Create()

if err != nil {
glog.V(vcoreparams.VCoreLogLevel).Infof("Error creating namespace %q: %v", nsName, err)

return false
}

err = wait.PollUntilContextTimeout(
context.TODO(),
time.Second,
3*time.Second,
true,
func(ctx context.Context) (bool, error) {
if !createNs.Exists() {
glog.V(vcoreparams.VCoreLogLevel).Infof("Error creating namespace %q", nsName)

return false, nil
}

glog.V(vcoreparams.VCoreLogLevel).Infof("Created namespace %q", createNs.Definition.Name)

return true, nil
})

if err != nil {
return false
}
}

return true
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func VerifyMetalLBOperatorDeployment(ctx SpecContext) {
time.Sleep(5 * time.Second)
}

err = await.WaitUntilNewDaemonSetIsRunning(APIClient,
err = await.WaitUntilDaemonSetIsRunning(APIClient,
vcoreparams.MetalLBDaemonSetName,
vcoreparams.MetalLBOperatorNamespace,
5*time.Minute)
Expand Down
Loading
Loading