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-3455: Skip legacy-etcd monitor tests in microshift #28874

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Changes from 1 commit
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
33 changes: 28 additions & 5 deletions pkg/monitortests/etcd/legacyetcdmonitortests/monitortest.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ import (

"github.com/openshift/origin/pkg/monitor/monitorapi"
"github.com/openshift/origin/pkg/test/ginkgo/junitapi"
exutil "github.com/openshift/origin/test/extended/util"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
)

type legacyMonitorTests struct {
adminRESTConfig *rest.Config
jobType *platformidentification.JobType
adminRESTConfig *rest.Config
jobType *platformidentification.JobType
notSupportedReason error
}

func NewLegacyTests() monitortestframework.MonitorTest {
Expand All @@ -24,6 +27,23 @@ func NewLegacyTests() monitortestframework.MonitorTest {

func (w *legacyMonitorTests) StartCollection(ctx context.Context, adminRESTConfig *rest.Config, recorder monitorapi.RecorderWriter) error {
w.adminRESTConfig = adminRESTConfig

kubeClient, err := kubernetes.NewForConfig(w.adminRESTConfig)
if err != nil {
return err
}

isMicroShift, err := exutil.IsMicroShiftCluster(kubeClient)
if err != nil {
return fmt.Errorf("unable to determine if cluster is MicroShift: %v", err)
}
if isMicroShift {
w.notSupportedReason = &monitortestframework.NotSupportedError{
Reason: "platform MicroShift not supported",
}
return w.notSupportedReason
}

jobType, err := platformidentification.GetJobType(ctx, adminRESTConfig)
if err != nil {
return fmt.Errorf("unable to determine job type: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at how w.jobType is actually used, it's just to temporarily adjust a threshold for vsphere which is struggling. This seems too thin a reason to permanently kill off several tests which help identify that etcd is struggling.

I'd suggest a safer route would be to modify this to not return an error here, set a default of an empty JobType{} with an empty string Platform.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that would certainly do, but I wonder if these tests are meaningful in MicroShift. We do not run etcd in a pod, and we have no events because of that (which is what all of these tests check).
Does it make sense to use a fake empty platform (or legit, depends on how you look at it!) only to know that any etcd test afterwards will check on non-existing events?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like about 5 tests are in here, 3 involve pod logs, so it sounds like those are irrelvant, the other is install related, which I'm guessing is not relevant to you either then, and lastly the clusteroperator state, do you have an etcd cluster operator in microshift? If not, then I would just add a comment along side your disable explaning why and we can merge this as is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We dont have etcd operator so I guess I will add the comment explaining why we can safely skip all tests here. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Expand All @@ -33,14 +53,17 @@ func (w *legacyMonitorTests) StartCollection(ctx context.Context, adminRESTConfi
}

func (w *legacyMonitorTests) CollectData(ctx context.Context, storageDir string, beginning, end time.Time) (monitorapi.Intervals, []*junitapi.JUnitTestCase, error) {
return nil, nil, nil
return nil, nil, w.notSupportedReason
}

func (*legacyMonitorTests) ConstructComputedIntervals(ctx context.Context, startingIntervals monitorapi.Intervals, recordedResources monitorapi.ResourcesMap, beginning, end time.Time) (monitorapi.Intervals, error) {
return nil, nil
func (w *legacyMonitorTests) ConstructComputedIntervals(ctx context.Context, startingIntervals monitorapi.Intervals, recordedResources monitorapi.ResourcesMap, beginning, end time.Time) (monitorapi.Intervals, error) {
return nil, w.notSupportedReason
}

func (w *legacyMonitorTests) EvaluateTestsFromConstructedIntervals(ctx context.Context, finalIntervals monitorapi.Intervals) ([]*junitapi.JUnitTestCase, error) {
if w.notSupportedReason != nil {
return nil, w.notSupportedReason
}
junits := []*junitapi.JUnitTestCase{}
junits = append(junits, testRequiredInstallerResourcesMissing(finalIntervals)...)
junits = append(junits, testEtcdShouldNotLogSlowFdataSyncs(finalIntervals)...)
Expand Down