Skip to content

Added needed infra setup + pgcluster integration test base#1796

Draft
M4KIF wants to merge 1 commit intofeature/database-controllersfrom
jkoterba/feature/postgres-cluster-tests
Draft

Added needed infra setup + pgcluster integration test base#1796
M4KIF wants to merge 1 commit intofeature/database-controllersfrom
jkoterba/feature/postgres-cluster-tests

Conversation

@M4KIF
Copy link
Copy Markdown

@M4KIF M4KIF commented Mar 26, 2026

Description

  • a wee bit of infra setup needed to execute the tests
  • one seemingly functional test along with a few stubs to be filled

Key Changes

  • tests

Testing and Verification

  • run tests localy

Related Issues

Jira tickets, GitHub issues, Support tickets...

PR Checklist

  • Code changes adhere to the project's coding standards.
  • Relevant unit and integration tests are included.
  • Documentation has been updated accordingly.
  • All tests pass locally.
  • The PR description follows the project's guidelines.

@github-actions
Copy link
Copy Markdown
Contributor

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contribution License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment with the exact sentence copied from below.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

// +kubebuilder:scaffold:scheme

By("bootstrapping test environment")
cnpgCRDDirectory, err := getCNPGCRDDirectory()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we should not leak anything specific to cnpg to this file as cnpg is low level details.

Copy link
Copy Markdown
Author

@M4KIF M4KIF Mar 30, 2026

Choose a reason for hiding this comment

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

So If we need to setup the env for the pgcluster controller, ie. setup It's dependency we should try to place It into the cluster setup fixture. That maybe trivial, Is that possible? ie. isn't the state of the k8s api and test env decided before the we pass down to per test fixtures?
Ie. lets compare It to the database transaction, isn't the "state" transaction already committed when we would try and alter It? (state stabilised and we try to append cnpg "resource"?)

In general I agree and hope that's possible to do

// +kubebuilder:scaffold:scheme

By("bootstrapping test environment")
cnpgCRDDirectory, err := getCNPGCRDDirectory()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why do we need this function?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

tbh, I haven't yet tried to minimise It. And tbh, I didn't exactly understand what happens here. So preparing cngp requires us to have the path of the cnpg(?).
Which is available as a go module, and the method tries to retrieve the path to cnpg "CRD"'s(?) which could or couldn't be available in the GOPATH. And statements in this method try to be as universal as possible by trying to consider every possible way this module is placed in the filesystem.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

after another round of reading I'm trying to use more domain specific language. Please correct me whenever I talk gibberish.

}).SetupWithManager(k8sManager); err != nil {
Expect(err).NotTo(HaveOccurred())
}
if err := (&IngestorClusterReconciler{
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why we did removed it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

my bad, was too focused on reaching sort of executability of the tests. Linked the cnpg and missed a change made.

@@ -1,5 +1,5 @@
/*
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we dont own this file I'd leave it alone or just make the simplest changes possible

@M4KIF M4KIF requested a review from mploski March 30, 2026 09:56
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.

2 participants