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

Update Cruise Control system tests #9574

Merged
merged 6 commits into from Jan 27, 2024
Merged

Update Cruise Control system tests #9574

merged 6 commits into from Jan 27, 2024

Conversation

kyguy
Copy link
Member

@kyguy kyguy commented Jan 19, 2024

Type of change

  • Refactoring

Description

Refactors Cruise Control system tests to remove system tests covered by unit tests and other system tests in attempt to reduce unnecessary test failures and resource usage.

Checklist

Please go through this checklist and make sure all applicable tasks have been done

  • Write tests
  • Make sure all tests pass
  • Update documentation
  • Check RBAC rights for Kubernetes / OpenShift roles
  • Try your changes from Pod inside your Kubernetes and OpenShift cluster, not just locally
  • Reference relevant issue(s) and close them after merging
  • Update CHANGELOG.md
  • Supply screenshots for visual changes, such as Grafana dashboards

@kyguy kyguy added this to the 0.40.0 milestone Jan 19, 2024
@kyguy kyguy force-pushed the update-cc-st branch 2 times, most recently from af48ba7 to c7e8739 Compare January 24, 2024 00:39
Signed-off-by: Kyle Liberti <kliberti@redhat.com>
@kyguy kyguy marked this pull request as ready for review January 24, 2024 02:49
@@ -256,6 +261,23 @@ void testConfigurationPerformanceOptions(ExtensionContext extensionContext) thro
assertThat(containerConfiguration, hasEntry(key, value.toString())));
}

@ParallelNamespaceTest
void testKafkaRebalanceAutoApprovalMechanism(ExtensionContext extensionContext) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't follow why you moved this here. This test seems to not be related to the other tests in this class. It tests the Cruise Control API (which is the KafkaRebalance resource). So it should have stayed where it was?

(Leaving aside that at least some tests in this class look like they should be unit tests and not system tests)

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't follow why you moved this here. This test seems to not be related to the other tests in this class. It tests the Cruise Control API (which is the KafkaRebalance resource). So it should have stayed where it was?

Whoops, I meant to move that in the CruiseControlST class. It seemed that the CruiseControlST class has tests related to the KafkaRebalance resource where as the CruiseControlApiST class seemed to contain tests for hitting/testing the CC API directly.

(Leaving aside that at least some tests in this class look like they should be unit tests and not system tests)

I'll investigate this class to to see what can be removed

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that makes sense I guess.

LOGGER.info("Verifying that {} REST API is available", CRUISE_CONTROL_NAME);
CruiseControlUtils.ApiResult response = CruiseControlUtils.callApi(testStorage.getNamespaceName(), CruiseControlUtils.HttpMethod.GET, CruiseControlEndpoints.STATE);
Copy link
Member

Choose a reason for hiding this comment

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

So, what exactly does this whole test test? And why is it not suported in KRaft mode? I guess that question applies to more of the tests in this class.

Copy link
Member Author

Choose a reason for hiding this comment

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

So, what exactly does this whole test test?

This is just to test basic CC API functionality, that you can get the state, execute rebalances, stop proposal execution, get user task list containing the previously executed tasks

And why is it not suported in KRaft mode?

Appears to be an oversight, let me clean that up

Copy link
Member

Choose a reason for hiding this comment

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

Do we really need to test these? I would expect that those are:

  • Tested by Cruise Controls own tests
  • Used in the KafkaRebalance tests

So I would expect here more or less just some check that we unlocked the REST API. But not detailed tests of different CC fetures.

Copy link
Member Author

Choose a reason for hiding this comment

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

So I would expect here more or less just some check that we unlocked the REST API. But not detailed tests of different CC fetures.

Yeah that sounds fair to me, I'll take a stab at it with the next commit

Signed-off-by: Kyle Liberti <kliberti@redhat.com>
@kyguy kyguy changed the title Update CruiseControlApiST tests Update Cruise Control system tests Jan 25, 2024
@scholzj
Copy link
Member

scholzj commented Jan 25, 2024

/azp run regression

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Kyle Liberti <kliberti@redhat.com>
Copy link
Member

@im-konge im-konge left a comment

Choose a reason for hiding this comment

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

Thanks for the clean-up, I have just one nit in indent.

Co-authored-by: Lukáš Král <53821852+im-konge@users.noreply.github.com>
Signed-off-by: Kyle Liberti <kliberti@redhat.com>
@scholzj
Copy link
Member

scholzj commented Jan 26, 2024

/azp run regression

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@@ -62,158 +51,29 @@ public class CruiseControlConfigurationST extends AbstractST {
private static final Logger LOGGER = LogManager.getLogger(CruiseControlConfigurationST.class);

@ParallelNamespaceTest
void testDeployAndUnDeployCruiseControl(ExtensionContext extensionContext) throws IOException {
void testMetricReporterConfigurationInKafka(ExtensionContext extensionContext) throws IOException {
Copy link
Member

Choose a reason for hiding this comment

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

This test seems to be failing. Also, I'm not sure why you made the changes you did here.

The original code seemed to be at least checking that the CC pod is removed and that rolling updates to do it were properly happening here. You now just check a config mpa with generated configuration. That is done in the unit tests already and does not need a system test. So we should either reintroduce the original logic or we can remove it completely.

Copy link
Member Author

Choose a reason for hiding this comment

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

Reverted to how it was before

Comment on lines 41 to 44
/**
* metrics
*/
METRICS("/metrics");
Copy link
Member

Choose a reason for hiding this comment

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

metrics => Metrics if we want to keep this. But I'm not sure it is worth to pull this into a production code when it is relevant only to tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed

Signed-off-by: Kyle Liberti <kliberti@redhat.com>
Signed-off-by: Kyle Liberti <kliberti@redhat.com>
@scholzj
Copy link
Member

scholzj commented Jan 27, 2024

/azp run regression

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@scholzj
Copy link
Member

scholzj commented Jan 27, 2024

Thanks @kyguy

@scholzj scholzj merged commit d52eafd into strimzi:main Jan 27, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants