-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: api client should set default telemetry if not specified
- Loading branch information
1 parent
9b6f886
commit ac935fb
Showing
2 changed files
with
26 additions
and
0 deletions.
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
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,23 @@ | ||
package openfga | ||
|
||
import ( | ||
"github.com/openfga/go-sdk/telemetry" | ||
"net/http" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func TestApiClientCreatedWithDefaultTelemetry(t *testing.T) { | ||
cfg := Configuration{ | ||
HTTPClient: &http.Client{Timeout: 10 * time.Second}, | ||
ApiUrl: "http://localhost:8080/", | ||
} | ||
_ = NewAPIClient(&cfg) | ||
|
||
telemetry1 := telemetry.Get(telemetry.TelemetryFactoryParameters{Configuration: cfg.Telemetry}) | ||
telemetry2 := telemetry.Get(telemetry.TelemetryFactoryParameters{Configuration: cfg.Telemetry}) | ||
|
||
if telemetry1 != telemetry2 { | ||
t.Fatalf("Telemetry instance should be the same") | ||
} | ||
} |