-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from mpmaruthu/ibu-testauto-basic
enabling lca pkg usage and defining ginkgo structure
- Loading branch information
Showing
19 changed files
with
1,633 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package imagebasedupgrade_test | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
_ "github.com/openshift-kni/eco-gosystem/tests/imagebasedupgrade/tests" | ||
) | ||
|
||
func TestImageBasedUpgrade(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "ImageBasedUpgrade Suite") | ||
} |
49 changes: 49 additions & 0 deletions
49
tests/imagebasedupgrade/internal/imagebasedupgradeinittools/imagebasedupgradeinittools.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package imagebasedupgradeinittools | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/golang/glog" | ||
"github.com/openshift-kni/eco-goinfra/pkg/clients" | ||
"github.com/openshift-kni/eco-gosystem/tests/imagebasedupgrade/internal/imagebasedupgradeparams" | ||
"github.com/openshift-kni/eco-gosystem/tests/internal/inittools" | ||
) | ||
|
||
var ( | ||
// SeedHubAPIClient is the api client to the hub cluster. | ||
SeedHubAPIClient *clients.Settings | ||
// TargetHubAPIClient is the api client to the hub cluster. | ||
TargetHubAPIClient *clients.Settings | ||
// SeedSNOAPIClient is the api client to the seed SNO cluster. | ||
SeedSNOAPIClient *clients.Settings | ||
// TargetSNOAPIClient is the api client to the target SNO cluster. | ||
TargetSNOAPIClient *clients.Settings | ||
) | ||
|
||
// init loads all variables automatically when this package is imported. Once package is imported a user has full | ||
// access to all vars within init function. It is recommended to import this package using dot import. | ||
func init() { | ||
SeedHubAPIClient = inittools.APIClient | ||
TargetHubAPIClient = inittools.APIClient | ||
SeedSNOAPIClient = DefineAPIClient(imagebasedupgradeparams.SeedSNOKubeEnvKey) | ||
TargetSNOAPIClient = DefineAPIClient(imagebasedupgradeparams.TargetSNOKubeEnvKey) | ||
} | ||
|
||
// DefineAPIClient creates new api client instance connected to given cluster. | ||
func DefineAPIClient(kubeconfigEnvVar string) *clients.Settings { | ||
kubeFilePath, present := os.LookupEnv(kubeconfigEnvVar) | ||
if !present { | ||
glog.Fatalf("can not load api client. Please check %s env var", kubeconfigEnvVar) | ||
|
||
return nil | ||
} | ||
|
||
client := clients.New(kubeFilePath) | ||
if client == nil { | ||
glog.Fatalf("client is not set please check %s env variable", kubeconfigEnvVar) | ||
|
||
return nil | ||
} | ||
|
||
return client | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/imagebasedupgrade/internal/imagebasedupgradeparams/const.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package imagebasedupgradeparams | ||
|
||
const ( | ||
// SeedHubKubeEnvKey is the hub's kubeconfig env var. | ||
SeedHubKubeEnvKey string = "KUBECONFIG_SEED_HUB" | ||
// TargetHubKubeEnvKey is the hub's kubeconfig env var. | ||
TargetHubKubeEnvKey string = "KUBECONFIG_TARGET_HUB" | ||
// SeedSNOKubeEnvKey is the seed kubeconfig env var. | ||
SeedSNOKubeEnvKey string = "KUBECONFIG_SEED_SNO" | ||
// TargetSNOKubeEnvKey is the target kubeconfig env var. | ||
TargetSNOKubeEnvKey string = "KUBECONFIG_TARGET_SNO" | ||
// ImagebasedupgradeCrName is the Imagebasedupgrade CR name. | ||
ImagebasedupgradeCrName string = "upgrade" | ||
// ImagebasedupgradeCrNamespace is the Imagebasedupgrade CR namespace. | ||
ImagebasedupgradeCrNamespace string = "openshift-lifecycle-agent" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package tests | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
"github.com/openshift-kni/eco-goinfra/pkg/lca" | ||
"github.com/openshift-kni/eco-goinfra/pkg/polarion" | ||
"github.com/openshift-kni/eco-gosystem/tests/imagebasedupgrade/internal/imagebasedupgradeinittools" | ||
"github.com/openshift-kni/eco-gosystem/tests/imagebasedupgrade/internal/imagebasedupgradeparams" | ||
) | ||
|
||
// IbuCr is a dedicated var to use and act on it. | ||
var IbuCr = lca.NewImageBasedUpgradeBuilder( | ||
imagebasedupgradeinittools.TargetSNOAPIClient, imagebasedupgradeparams.ImagebasedupgradeCrName) | ||
|
||
var _ = Describe( | ||
"HappyPathUpgrade", | ||
Ordered, | ||
ContinueOnFailure, | ||
Label("HappyPathUpgrade"), func() { | ||
BeforeAll(func() { | ||
By("Generating seed image", func() { | ||
// Test Automation Code Implementation is to be done. | ||
}) | ||
}) | ||
|
||
AfterAll(func() { | ||
// Rollback to pre-upgrade state and reset PolicyGenTemplate. | ||
}) | ||
|
||
It("End to end upgrade happy path", polarion.ID("68954"), Label("HappyPathUpgrade"), func() { | ||
|
||
By("Checking ImageBasedUpgrade CR exists with Idle stage in Target SNO", func() { | ||
crExists := IbuCr.Exists() | ||
Expect(crExists).To(BeTrue()) | ||
}) | ||
|
||
By("Updating ImageBasedUpgrade CR with Prep stage in Target SNO", func() { | ||
IbuCr.WithStage("Prep") | ||
}) | ||
|
||
By("Updating ImageBasedUpgrade CR with Upgrade stage in Target SNO", func() { | ||
IbuCr.WithStage("Upgrade") | ||
}) | ||
|
||
By(" Verifying target SNO cluster ACM registration post upgrade", func() { | ||
|
||
}) | ||
|
||
By("Updating ImageBasedUpgrade CR with Idle stage in Target SNO", func() { | ||
IbuCr.WithStage("Idle") | ||
|
||
}) | ||
}) | ||
}) |
10 changes: 10 additions & 0 deletions
10
vendor/github.com/openshift-kni/eco-goinfra/pkg/clients/clients.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.