Skip to content

Conversation

@dvyukov
Copy link
Collaborator

@dvyukov dvyukov commented Dec 29, 2025

  • tools/docker/env: add spanner emulator
  • dashboard/app: make it possible to test code that uses spanner

@dvyukov dvyukov changed the title dvyukov spanner tests dashboard/app: make it possible to test code that uses spanner Dec 29, 2025
@dvyukov dvyukov requested review from a-nogikh and tarasmadan and removed request for tarasmadan December 29, 2025 11:46
@dvyukov dvyukov force-pushed the dvyukov-spanner-tests branch from 3ae982b to c46d667 Compare December 29, 2025 11:56
@a-nogikh
Copy link
Collaborator

FWIW there's already syz-cluster code that interacts with the spanner emulator:
https://github.com/google/syzkaller/blob/master/syz-cluster/pkg/db/spanner.go#L138

I wonder if we can somehow reuse that instead of duplicating the functionality.

@tarasmadan
Copy link
Collaborator

And let me remind about the mocking code in case you'll find it useful: https://github.com/google/syzkaller/tree/master/pkg/coveragedb/mocks

@dvyukov dvyukov force-pushed the dvyukov-spanner-tests branch from c46d667 to 1fef5ad Compare December 29, 2025 14:44
@dvyukov
Copy link
Collaborator Author

dvyukov commented Dec 29, 2025

And let me remind about the mocking code in case you'll find it useful: https://github.com/google/syzkaller/tree/master/pkg/coveragedb/mocks

No, I don't want to use mocks. With mocks:

  1. I won't test actual SQL queries (high chances of errors b/c it's just text)
  2. I won't test DDL statements used to setup database
  3. code may work with mocks, but not in production, if mocks return the data tests want, so it's not really testing what I want
  4. more code to write and tests are more fragile

Using the emulator solves all of the above.

@dvyukov
Copy link
Collaborator Author

dvyukov commented Dec 29, 2025

FWIW there's already syz-cluster code that interacts with the spanner emulator: https://github.com/google/syzkaller/blob/master/syz-cluster/pkg/db/spanner.go#L138

I wonder if we can somehow reuse that instead of duplicating the functionality.

Ok, let's start with #6533 then ;)

@dvyukov dvyukov force-pushed the dvyukov-spanner-tests branch 2 times, most recently from f8213bf to fa93e10 Compare December 30, 2025 17:14
@dvyukov dvyukov requested a review from a-nogikh December 30, 2025 17:20
@dvyukov
Copy link
Collaborator Author

dvyukov commented Dec 30, 2025

FWIW there's already syz-cluster code that interacts with the spanner emulator: https://github.com/google/syzkaller/blob/master/syz-cluster/pkg/db/spanner.go#L138
I wonder if we can somehow reuse that instead of duplicating the functionality.

Done. Reused emulator start code and create instance/database from the existing code.
PTAL.

@dvyukov dvyukov force-pushed the dvyukov-spanner-tests branch from fa93e10 to 203b9f1 Compare December 31, 2025 11:02
@dvyukov dvyukov requested a review from a-nogikh December 31, 2025 11:04
@dvyukov dvyukov force-pushed the dvyukov-spanner-tests branch from 203b9f1 to ca90bd4 Compare December 31, 2025 11:17
@dvyukov dvyukov force-pushed the dvyukov-spanner-tests branch from ca90bd4 to 87f98ed Compare December 31, 2025 11:53
a-nogikh
a-nogikh previously approved these changes Dec 31, 2025
Start spanner emulator for tests.
Create isolated per-test instance+database.
Test that DDL migration scripts are work.
@dvyukov dvyukov added this pull request to the merge queue Dec 31, 2025
Merged via the queue into google:master with commit 2733a37 Dec 31, 2025
18 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.

3 participants