Skip to content

add firestore-backed application datastore integration test - #7077

Open
ayushsarode wants to merge 7 commits into
pipe-cd:masterfrom
ayushsarode:add-firestore-test
Open

ayushsarode wants to merge 7 commits into
pipe-cd:masterfrom
ayushsarode:add-firestore-test

Conversation

@ayushsarode

Copy link
Copy Markdown

What this PR does:

Adds integration test coverage for the Firestore-backed application datastore.

The tests cover core application datastore behavior against Firestore, including creating, retrieving, listing, updating, and deleting application records where applicable. This follows the existing datastore integration test pattern used in the repository.

Why we need it:

Application data is a core part of PipeCD’s datastore layer, and Firestore-specific behavior can differ from unit-test assumptions around document structure, queries, updates, and serialization.

Adding integration coverage helps catch regressions earlier and gives maintainers more confidence that the Firestore implementation stays consistent with the expected datastore contract.

Which issue(s) this PR fixes:

Fixes #7076

Does this PR introduce a user-facing change?:

No.

  • How are users affected by this change:
    Users are not directly affected. This is a test-only change that improves confidence in Firestore datastore behavior.

  • Is this breaking change:
    No.

  • How to migrate (if breaking change):
    Not applicable.

Signed-off-by: ayushsarode <ayushsarode777@gmail.com>
@ayushsarode
ayushsarode requested a review from a team as a code owner July 23, 2026 07:56
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi @ayushsarode, welcome to PipeCD and thanks for opening your first pull request!

We’re really happy to have you here

Before your PR gets merged, please check a few important things below.


Helpful resources


DCO Sign-off

All commits must include a Signed-off-by line to comply with the Developer Certificate of Origin (DCO).

In case you forget to sign-off your commit(s), follow these steps:

For the last commit:

git commit --amend --signoff
git push --force-with-lease

For multiple commits:

git rebase --signoff origin/master
git push --force-with-lease

Run checks locally

Before pushing updates, please run:

make check

This runs the same checks as CI and helps catch issues early.


💬 Need help?

If anything is unclear, feel free to ask in this PR or join us on the CNCF Slack in the #pipecd channel.
You can get your Slack invite from: https://communityinviter.com/apps/cloud-native/cncf

Thanks for contributing to PipeCD! ❤️

@ayushsarode

Copy link
Copy Markdown
Author

@rahulshendre please lmk if this integration test PR adds value

@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions Bot added the Stale label Aug 31, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

This PR was closed because it has been stalled for 7 days with no activity. Feel free to reopen if still applicable.

@github-actions github-actions Bot closed this Sep 8, 2026
@rahulshendre rahulshendre reopened this Sep 8, 2026
@rahulshendre rahulshendre removed the Stale label Sep 8, 2026
@rahulshendre

Copy link
Copy Markdown
Contributor

@netlify

netlify Bot commented Sep 8, 2026

Copy link
Copy Markdown

Deploy Preview for pipecd-site canceled.

Name Link
🔨 Latest commit 4b27d5c
🔍 Latest deploy log https://app.netlify.com/projects/pipecd-site/deploys/6aac030f40b70b0008f609e8

@armistcxy

armistcxy commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Hi @ayushsarode, sorry for late reply

Please consider adding test for FindApplication like the way MySQL did

func TestFindApplication(t *testing.T) {

Also I found out that the added tests are near identical versions of generic tests from firestore_test.go

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Add listing coverage and verify persisted fields after successful creation and update.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds Firestore-backed integration tests for application datastore behavior.

Changes:

  • Tests retrieval, creation, duplicate handling, and updates.
  • Covers error and success paths against Firestore.
  • Listing coverage and persistence assertions remain unresolved.
File summaries
File Summary
test/integration/datastore/firestore/application_test.go Adds Firestore application datastore integration tests.
Review details

Suppressed comments (1)

test/integration/datastore/firestore/application_test.go:124

  • The successful create case only checks that Create returned nil; it never reads the document back. A Firestore write or serialization bug could therefore pass this test, and the successful case also uses id-new while the entity still has Id: "create-id". Fetch the new document and assert its stored fields (or make the entity ID match the document ID).
	for _, tc := range testcases {
		t.Run(tc.name, func(t *testing.T) {
			err := store.Create(ctx, col, tc.id, fakeApplication)
			assert.Equal(t, tc.wantErr, err)
  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

}
}

func TestUpdateApplication(t *testing.T) {
Comment on lines +187 to +192
for _, tc := range testcases {
t.Run(tc.name, func(t *testing.T) {
err := store.Update(ctx, col, tc.id, tc.updater)
assert.Equal(t, tc.wantErr, err)
})
}
ayushsarode and others added 2 commits September 15, 2026 21:55
Replace redundant Application CRUD tests with Find coverage matching
the MySQL integration test, since generic CRUD is already covered in
firestore_test.go.
Signed-off-by: ayushsarode <ayushsarode777@gmail.com>
@ayushsarode

Copy link
Copy Markdown
Author

@armistcxy could you please review it now?

@armistcxy

Copy link
Copy Markdown
Contributor

wait, I've asked you to add the FindApplicationTest, why you delete all the old tests for Get, Create, Update application ?

@ayushsarode

Copy link
Copy Markdown
Author

Hi @armistcxy , my apologies for that!
It was an accidental deletion on my end when adding the FindApplication test. I've just restored the Get, Create, and Update tests and pushed the fix. Thanks for catching this!

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.

Add Firestore integration tests for application datastore

4 participants