8000 End to end tests for Tomcat operator by adam-sandor · Pull Request #13 · java-operator-sdk/samples · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jan 4, 2022. It is now read-only.

End to end tests for Tomcat operator #13

Merged
merged 46 commits into from
Sep 17, 2021
Merged

Conversation

adam-sandor
Copy link
Member

These tests are meant to be the blueprint for future end-to-end tests. This PR also includes significant fixes to the TomcatOperator to fix issues revealed by the tests.

The important characteristics of this test are:

  • Builds and deploys the operator to a real Kubernetes cluster
  • Uses Github pipelines to set up a fresh Kubernetes cluster and deploy CRDs
  • The verification stage is written in JUnit
  • Each verification retries the assertions until they succeed or a timout is reached. This allows us to work with high timeouts as success is detected immediately (compared to sleep which waits in both cases).

@adam-sandor
Copy link
Member Author

Hold the reviews, looks like the test is failing.

@adam-sandor
Copy link
Member Author

Ready for review

@adam-sandor adam-sandor merged commit ad32eb0 into main Sep 17, 2021
@adam-sandor adam-sandor deleted the finalize-tomcat-test branch September 17, 2021 09:15
Copy link
@metacosm metacosm left a comment

Choose a reason for hiding this comment

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

Sorry for the late review… 😓
I feel that we can improve all of this somehow. Maybe by making the IntegrationTestSupport class found in JOSDK more generic?

- uses: actions/cache@v2
distribution: adopt-hotspot

- name: cache

Choose a reason for hiding this comment

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

This isn't needed anymore with setup-java v2. See operator-framework/java-operator-sdk#527 for details. Then again, maybe you need more control on the caching that what's provided by default?

${{ runner.os }}-maven-
${{ runner.os }}-maven-m2

- name: Set up Maven

Choose a reason for hiding this comment

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

Isn't maven set up as part of setup-java already?

- name: Create Kubernetes KinD Cluster
uses: container-tools/kind-action@v1.5.0
with:
cluster_name: tomcat-integration-test

Choose a reason for hiding this comment

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

Shouldn't this use ${KIND_CL_NAME} instead?

</properties>

<dependencies>
<dependency>
<groupId>io.javaoperatorsdk</groupId>
<artifactId>operator-framework</artifactId>
<version>1.8.4</version>
<version>1.9.2</version>

Choose a reason for hiding this comment

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

1.9.6 is available 😉


@Test
public void test() {
Config config = new ConfigBuilder().withNamespace(null).build();

Choose a reason for hiding this comment

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

You could probably use: Config.autoConfigure(null) instead here.

@adam-sandor
Copy link
Member Author

Thanks @metacosm I'll fix these with another PR.

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.notNullValue;

public class IntegrationTest {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we brake this method into smaller chuns based on semantics, it's kinda hard to follow this way.

B064
Copy link
Contributor
@csviri csviri left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0