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

tests: test_pgdata_import_smoke requires the 'testing' cargo feature #10569

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

hlinnaka
Copy link
Contributor

It took me ages to figure out why it was failing on my laptop. What I saw was that when the test makes the 'import_pgdata' in the pageserver, the pageserver actually performs a regular 'bootstrap' timeline creation by running initdb, with no importing. It boiled down to the json request that the test uses:

        {
            "new_timeline_id": str(timeline_id),
            "import_pgdata": {
                "idempotency_key": str(idempotency),
                "location": {"LocalFs": {"path": str(importbucket.absolute())}},
            },
        },

and how serde deserializes into rust structs. The 'LocalFs' enum variant in models.rs is gated on the 'testing' cargo feature. On a non-testing build, that got deserialized into the default Bootstrap enum variant, as a valid TimelineCreateRequestModeImportPgdata variant could not be formed.

PS. IMHO we should get rid of the testing feature, compile in all the functionality, and have a runtime flag to disable anything dangeorous. With that, you would've gotten a nice "feature only enabled in testing mode" error in this case, or the test would've simply worked. But that's another story.

It took me ages to figure out why it was failing on my laptop. What I
saw was that when the test makes the 'import_pgdata' in the
pageserver, the pageserver actually performs a regular 'bootstrap'
timeline creation by running initdb, with no importing. It boiled down
to the json request that the test uses:

```
        {
            "new_timeline_id": str(timeline_id),
            "import_pgdata": {
                "idempotency_key": str(idempotency),
                "location": {"LocalFs": {"path": str(importbucket.absolute())}},
            },
        },
```

and how serde deserializes into rust structs. The 'LocalFs' enum
variant in `models.rs` is gated on the 'testing' cargo feature. On a
non-testing build, that got deserialized into the default Bootstrap
enum variant, as a valid TimelineCreateRequestModeImportPgdata variant
could not be formed.

PS. IMHO we should get rid of the testing feature, compile in all the
functionality, and have a runtime flag to disable anything
dangeorous. With that, you would've gotten a nice "feature only
enabled in testing mode" error in this case, or the test would've
simply worked. But that's another story.
Copy link

7414 tests run: 7063 passed, 0 failed, 351 skipped (full report)


Flaky tests (6)

Postgres 17

Code coverage* (full report)

  • functions: 33.3% (8498 of 25491 functions)
  • lines: 49.1% (71441 of 145516 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
a615baa at 2025-01-29T20:39:56.531Z :recycle:

@skyzh skyzh added this pull request to the merge queue Jan 30, 2025
Merged via the queue into main with commit efe42db Jan 30, 2025
86 checks passed
@skyzh skyzh deleted the heikki/test_pgdata_import_smoke-requires-testing-option branch January 30, 2025 16:13
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