Skip to content

Fix auth for sample upsert stream#48

Merged
Marenz merged 3 commits intofrequenz-floss:v0.x.xfrom
Marenz:fix/api-update-market-area-refactor
Apr 7, 2026
Merged

Fix auth for sample upsert stream#48
Marenz merged 3 commits intofrequenz-floss:v0.x.xfrom
Marenz:fix/api-update-market-area-refactor

Conversation

@Marenz
Copy link
Copy Markdown
Contributor

@Marenz Marenz commented Apr 2, 2026

The client currently gets auth and signing metadata from frequenz-client-base only for unary-unary and unary-stream RPCs. UpsertMarketLocationSamplesStream is a streaming upsert call, so it missed the key, timestamp, nonce, and signature metadata and the service rejected it with a missing-signature authentication error.

This attaches the same metadata explicitly for the upsert stream call and adds a regression test covering the streaming path.

Verified with:

  • uv run pytest tests/test_marketmetering.py -q
  • end-to-end client flow against market-metering.eu-1.production.api.frequenz.com covering list, create, update, deactivate, activate, upsert_samples, and stream_samples

Update test helpers and assertions to match the d9a23f3 proto changes:
market_area moved to MarketLocationRef, MarketLocationId.value wrapped
in MarketLocationIdValue, structured errors replace flat success/error_code
fields. Register the integration pytest mark in pyproject.toml.

Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
@Marenz Marenz requested a review from a team as a code owner April 2, 2026 14:58
@Marenz Marenz requested review from daniel-zullo-frequenz and removed request for a team April 2, 2026 14:58
@github-actions github-actions bot added part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.) labels Apr 2, 2026
@Marenz Marenz force-pushed the fix/api-update-market-area-refactor branch from 3eab7c9 to 3b1e776 Compare April 2, 2026 15:34
@github-actions github-actions bot added the part:docs Affects the documentation label Apr 2, 2026
@Marenz Marenz force-pushed the fix/api-update-market-area-refactor branch 5 times, most recently from 9f51ff3 to 4973d72 Compare April 2, 2026 16:08
Copy link
Copy Markdown
Contributor

@daniel-zullo-frequenz daniel-zullo-frequenz left a comment

Choose a reason for hiding this comment

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

Only have a question about a test, and LGTM

The client got authentication and signing metadata from
frequenz-client-base only for unary-unary and unary-stream RPCs.
UpsertMarketLocationSamplesStream is a streaming upsert call, so it
missed the key, timestamp, nonce, and signature metadata and the
service rejected it with a missing-signature authentication error.

Attach the same metadata explicitly for the upsert stream call and add
a regression test covering the streaming path.

Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
@Marenz Marenz added this pull request to the merge queue Apr 7, 2026
Integration tests now use testcontainers to spin up GreptimeDB and
the marketmeteringd service binary automatically.

- Added testcontainers and requests dependencies to dev-pytest
- Created conftest.py with fixtures for:
  - GreptimeDB container
  - marketmeteringd service process
  - Database schema initialization
- Updated test_integration.py to use new fixtures
- Tests skip automatically when Docker is unavailable

Requires:
- Docker running
- Service binary at ../frequenz-service-marketmetering/target/release/marketmeteringd

Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
@Marenz Marenz changed the title Fix auth for sample upsert stream WIP: Fix auth for sample upsert stream + Add testcontainers for integration tests Apr 7, 2026
@Marenz Marenz marked this pull request as draft April 7, 2026 11:19
@Marenz Marenz changed the title WIP: Fix auth for sample upsert stream + Add testcontainers for integration tests WIP: Add testcontainers for integration tests Apr 7, 2026
Merged via the queue into frequenz-floss:v0.x.x with commit a316d7e Apr 7, 2026
3 checks passed
@Marenz Marenz deleted the fix/api-update-market-area-refactor branch April 7, 2026 11:22
@Marenz Marenz changed the title WIP: Add testcontainers for integration tests Fix auth for sample upsert stream Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants