generated from micronaut-projects/micronaut-project-template
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OCI SDK doesn't have service with telemetry-ingestion so we create one
- Loading branch information
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...loud/monitoring/micrometer/OracleCloudMonitorClientEndpointUsingRegionProviderSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.micronaut.oraclecloud.monitoring.micrometer | ||
|
||
import com.oracle.bmc.Region | ||
import com.oracle.bmc.auth.RegionProvider | ||
import io.micronaut.context.ApplicationContext | ||
import io.micronaut.context.annotation.* | ||
import io.micronaut.oraclecloud.monitoring.MonitoringIngestionClient | ||
import io.micronaut.test.extensions.spock.annotation.MicronautTest | ||
import jakarta.inject.Inject | ||
import jakarta.inject.Singleton | ||
import spock.lang.Specification | ||
|
||
@MicronautTest(startApplication = false) | ||
@Property(name="micronaut.metrics.export.oraclecloud.enabled", value = "false") | ||
@Property(name="spec.name", value = "OracleCloudMonitorClientEndpointUsingRegionProviderSpec") | ||
class OracleCloudMonitorClientEndpointUsingRegionProviderSpec extends Specification { | ||
|
||
@Inject | ||
ApplicationContext context | ||
|
||
def "test oci sdk metrics client filter request returns exception" () { | ||
when: | ||
MonitoringIngestionClient monitoringIngestionClient = context.getBean(MonitoringIngestionClient) | ||
def delegate = monitoringIngestionClient.getDelegate() | ||
|
||
then: | ||
delegate.getEndpoint() == "https://telemetry-ingestion.eu-jovanovac-1.oraclecloud20.com" | ||
} | ||
|
||
@Singleton | ||
@BootstrapContextCompatible | ||
@Primary | ||
@Replaces(RegionProvider.class) | ||
@Requires(property = "spec.name", value = "OracleCloudMonitorClientEndpointUsingRegionProviderSpec") | ||
static class RegionProviderReplacement implements RegionProvider { | ||
|
||
@Override | ||
Region getRegion() { | ||
return Region.EU_JOVANOVAC_1 | ||
} | ||
} | ||
|
||
} |