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

USHIFT-704: skip [sig-cli] whoami result with console for MicroShift #28005

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 17 additions & 1 deletion cmd/openshift-tests/provider.go
Expand Up @@ -78,7 +78,23 @@ func initializeTestFramework(context *e2e.TestContextType, config *exutilcluster
func decodeProvider(provider string, dryRun, discover bool, clusterState *exutilcluster.ClusterState) (*exutilcluster.ClusterConfiguration, error) {
switch provider {
case "none":
return &exutilcluster.ClusterConfiguration{ProviderName: "skeleton"}, nil
config := &exutilcluster.ClusterConfiguration{
ProviderName: "skeleton",
}
// Add NoOptionalCapabilities for MicroShift
coreClient, err := e2e.LoadClientset(true)
if err != nil {
return nil, err
}
isMicroShift, err := exutil.IsMicroShiftCluster(coreClient)
if err != nil {
return nil, err
}
if isMicroShift {
config.HasNoOptionalCapabilities = true
}

return config, nil

case "":
if _, ok := os.LookupEnv("KUBE_SSH_USER"); ok {
Expand Down
2 changes: 1 addition & 1 deletion test/extended/cli/explain.go
Expand Up @@ -475,7 +475,7 @@ var (
)

func getCrdTypes(oc *exutil.CLI) []schema.GroupVersionResource {
isMicroShift, err := exutil.IsMicroShiftCluster(oc)
isMicroShift, err := exutil.IsMicroShiftCluster(oc.AdminKubeClient())
o.Expect(err).NotTo(o.HaveOccurred())
if isMicroShift {
return microshiftCRDTypes
Expand Down
6 changes: 4 additions & 2 deletions test/extended/util/framework.go
Expand Up @@ -2094,9 +2094,11 @@ func DoesApiResourceExist(config *rest.Config, apiResourceName, groupVersionName
return false, nil
}

func IsMicroShiftCluster(oc *CLI) (bool, error) {
// IsMicroShiftCluster returns "true" if a cluster is MicroShift,
// "false" otherwise. It needs kube-admin client as input.
func IsMicroShiftCluster(kubeClient k8sclient.Interface) (bool, error) {
bparees marked this conversation as resolved.
Show resolved Hide resolved
// MicroShift cluster contains "microshift-version" configmap in "kube-public" namespace
cm, err := oc.AdminKubeClient().CoreV1().ConfigMaps("kube-public").Get(context.Background(), "microshift-version", metav1.GetOptions{})
cm, err := kubeClient.CoreV1().ConfigMaps("kube-public").Get(context.Background(), "microshift-version", metav1.GetOptions{})
if err != nil {
if kapierrs.IsNotFound(err) {
e2e.Logf("microshift-version configmap not found")
Expand Down