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

MGMT-19258: Split KubeAPI and non KubeAPI subsystem tests #7154

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,10 @@ deploy-dev-infra: create-hub-cluster
########

test:
$(MAKE) _run_subsystem_test AUTH_TYPE=rhsso ENABLE_ORG_TENANCY=true ENABLE_ORG_BASED_FEATURE_GATES=true
$(MAKE) _run_subsystem_test AUTH_TYPE=rhsso ENABLE_ORG_TENANCY=true ENABLE_ORG_BASED_FEATURE_GATES=true TEST="$(or $(TEST),'github.com/openshift/assisted-service/subsystem')"

test-kube-api:
$(MAKE) _run_subsystem_test AUTH_TYPE=local FOCUS="$(or ${FOCUS},kube-api)"
$(MAKE) _run_subsystem_test AUTH_TYPE=local TEST="$(or $(TEST),'github.com/openshift/assisted-service/subsystem/kubeapi')"

# Alias for test
subsystem-test: test
Expand Down Expand Up @@ -490,7 +490,7 @@ _run_subsystem_test:
TEST_TOKEN_UNALLOWED="$(shell cat $(BUILD_FOLDER)/auth-tokenUnallowedString)" \
TEST_TOKEN_EDITOR="$(shell cat $(BUILD_FOLDER)/auth-tokenClusterEditor)" \
RELEASE_SOURCES='$(or ${RELEASE_SOURCES},${DEFAULT_RELEASE_SOURCES})' \
$(MAKE) _test TEST_SCENARIO=subsystem TIMEOUT=120m TEST="$(or $(TEST),./subsystem/...)"
$(MAKE) _test TEST_SCENARIO=subsystem TIMEOUT=120m

enable-kube-api-for-subsystem: $(BUILD_FOLDER)
$(MAKE) deploy-service-requirements AUTH_TYPE=local ENABLE_KUBE_API=true ALLOW_CONVERGED_FLOW=true ISO_IMAGE_TYPE=minimal-iso
Expand Down
4 changes: 2 additions & 2 deletions hack/add_wiremock_stubs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/kelseyhightower/envconfig"
"github.com/openshift/assisted-service/models"
"github.com/openshift/assisted-service/pkg/auth"
"github.com/openshift/assisted-service/subsystem"
"github.com/openshift/assisted-service/subsystem/utils_test"
"github.com/sirupsen/logrus"
)

Expand Down Expand Up @@ -39,7 +39,7 @@ func main() {
log.Fatal("Fail to parse release sources, ", err)
}

wiremock := &subsystem.WireMock{
wiremock := &utils_test.WireMock{
OCMHost: Options.OCMBaseURL,
ReleaseSources: releaseSources,
}
Expand Down
15 changes: 8 additions & 7 deletions subsystem/agent_based_installer_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@ import (
"github.com/openshift/assisted-service/cmd/agentbasedinstaller"
"github.com/openshift/assisted-service/internal/common"
"github.com/openshift/assisted-service/internal/network"
"github.com/openshift/assisted-service/subsystem/utils_test"
)

// Note: userBMClient is used because subsystems defaults to use "rhsso" as AUTH_TYPE.
// Note: utils_test.TestContext.UserBMClient is used because subsystems defaults to use "rhsso" as AUTH_TYPE.
// The ephermeral installer environment will use the "none" AUTH_TYPE at the start, and
// a pre-generated infra-env-id will be used when creating the infra-env.
// A new authentication scheme suited to the agent-based installer will be implemented
// in the future and userBMClient should be replaced at that time.
// in the future and utils_test.TestContext.UserBMClient should be replaced at that time.
var _ = Describe("RegisterClusterAndInfraEnv", func() {
ctx := context.Background()

It("good flow", func() {
modelCluster, registerClusterErr := agentbasedinstaller.RegisterCluster(ctx, log, userBMClient, pullSecret,
modelCluster, registerClusterErr := agentbasedinstaller.RegisterCluster(ctx, log, utils_test.TestContext.UserBMClient, pullSecret,
"../docs/hive-integration/crds/clusterDeployment.yaml",
"../docs/hive-integration/crds/agentClusterInstall.yaml",
"../docs/hive-integration/crds/clusterImageSet.yaml", "")
Expand All @@ -30,7 +31,7 @@ var _ = Describe("RegisterClusterAndInfraEnv", func() {
Expect(modelCluster.CPUArchitecture).To(Equal("x86_64"))
Expect(modelCluster.Name).To(Equal("test-cluster"))

modelInfraEnv, registerInfraEnvErr := agentbasedinstaller.RegisterInfraEnv(ctx, log, userBMClient, pullSecret,
modelInfraEnv, registerInfraEnvErr := agentbasedinstaller.RegisterInfraEnv(ctx, log, utils_test.TestContext.UserBMClient, pullSecret,
modelCluster, "../docs/hive-integration/crds/infraEnv.yaml",
"../docs/hive-integration/crds/nmstate.yaml", "full-iso", "")

Expand All @@ -41,7 +42,7 @@ var _ = Describe("RegisterClusterAndInfraEnv", func() {
})

It("InstallConfig override good flow", func() {
modelCluster, registerClusterErr := agentbasedinstaller.RegisterCluster(ctx, log, userBMClient, pullSecret,
modelCluster, registerClusterErr := agentbasedinstaller.RegisterCluster(ctx, log, utils_test.TestContext.UserBMClient, pullSecret,
"../docs/hive-integration/crds/clusterDeployment.yaml",
"../docs/hive-integration/crds/agentClusterInstall-with-installconfig-overrides.yaml",
"../docs/hive-integration/crds/clusterImageSet.yaml", "")
Expand All @@ -53,7 +54,7 @@ var _ = Describe("RegisterClusterAndInfraEnv", func() {
Expect(modelCluster.InstallConfigOverrides).To(Equal(`{"fips": true}`))
Expect(modelCluster.Name).To(Equal("test-cluster"))

modelInfraEnv, registerInfraEnvErr := agentbasedinstaller.RegisterInfraEnv(ctx, log, userBMClient, pullSecret,
modelInfraEnv, registerInfraEnvErr := agentbasedinstaller.RegisterInfraEnv(ctx, log, utils_test.TestContext.UserBMClient, pullSecret,
modelCluster, "../docs/hive-integration/crds/infraEnv.yaml",
"../docs/hive-integration/crds/nmstate.yaml", "full-iso", "")

Expand All @@ -64,7 +65,7 @@ var _ = Describe("RegisterClusterAndInfraEnv", func() {
})

It("missing one of the ZTP manifests", func() {
modelCluster, registerClusterErr := agentbasedinstaller.RegisterCluster(ctx, log, userBMClient, pullSecret,
modelCluster, registerClusterErr := agentbasedinstaller.RegisterCluster(ctx, log, utils_test.TestContext.UserBMClient, pullSecret,
"file-does-not-exist",
"../docs/hive-integration/crds/agentClusterInstall.yaml",
"../docs/hive-integration/crds/clusterImageSet.yaml", "")
Expand Down
Loading