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

Test Loki client integration. #4

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

jeschkies
Copy link
Contributor

This change formats the test code and introduces a Loki testcontainer that's used in a simple Loki client push integration test.

Closes https://github.com/grafana/grafana-csp-app/issues/225

from requests import Response


# TODO: contribute to testcontainers modules
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Once this lands I'd like to contribute it upstream to https://github.com/testcontainers/testcontainers-python/tree/main/modules

Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to testcontainers/testcontainers-python#733 they might not accept it because it's too simple 🤷

@jeschkies jeschkies force-pushed the karsten/test-integration branch from efcbfcc to fab62e6 Compare November 5, 2024 13:28
"""This method starts the Loki container and runs the readniness check
to verify that the container is ready to use."""
super().start()
self._readiness_check()
Copy link
Contributor

Choose a reason for hiding this comment

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

According to this it has a 120s timeout, should we do less?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Loki does take a while to become ready.

return loki.get_client()


def test_push(client: LokiClient):
Copy link
Contributor

Choose a reason for hiding this comment

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

😮‍💨

@jeschkies jeschkies merged commit dcb7c2c into feature/python Nov 5, 2024
2 checks passed
@jeschkies jeschkies deleted the karsten/test-integration branch November 5, 2024 13:38
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