(settings: SettingsWrapper)
| 42 | |
| 43 | @pytest.fixture() |
| 44 | def influxdb(settings: SettingsWrapper) -> InfluxDBClient: |
| 45 | settings.INFLUXDB_BUCKET = "api_usage" |
| 46 | settings.INFLUXDB_URL = "http://localhost:8086" |
| 47 | settings.INFLUXDB_ORG = "flagsmith" |
| 48 | settings.INFLUXDB_TOKEN = "admin-token" |
| 49 | |
| 50 | # Matches api.app_analytics.influxdb_wrapper bucket definitions |
| 51 | client = InfluxDBWrapper.get_client() |
| 52 | bucket_api = client.buckets_api() |
| 53 | bucket_names = [ |
| 54 | "api_usage_downsampled_15m", |
| 55 | "api_usage_downsampled_1h", |
| 56 | ] |
| 57 | for bucket_name in bucket_names: |
| 58 | if not bucket_api.find_bucket_by_name(bucket_name): # type: ignore[no-untyped-call] |
| 59 | bucket_api.create_bucket( |
| 60 | org="flagsmith", |
| 61 | bucket_name=bucket_name, |
| 62 | ) |
| 63 | |
| 64 | return client |
| 65 | |
| 66 | |
| 67 | @pytest.fixture() |
nothing calls this directly
no test coverage detected
searching dependent graphs…