Skip to content

Commit

Permalink
Latest generator changes + fix UT
Browse files Browse the repository at this point in the history
  • Loading branch information
venkat-iblox committed Jan 30, 2024
1 parent d5706ba commit 6c9cf17
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
17 changes: 15 additions & 2 deletions client/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package client
import (
"fmt"
"net/http"
"os"
"reflect"
"testing"

Expand Down Expand Up @@ -70,7 +71,7 @@ func TestConfiguration_internal(t *testing.T) {
{
"DefaultTags provided",
fields{
CSPURL: "https://csp.infoblox.com",
CSPURL: "https://stage.csp.infoblox.com",
ClientName: "terraformv1.1#yug278872h",
APIKey: "12323455",
DefaultTags: map[string]string{
Expand All @@ -87,7 +88,7 @@ func TestConfiguration_internal(t *testing.T) {
},
Debug: false,
UserAgent: fmt.Sprintf("bloxone-%s/%s", sdkIdentifier, version),
Servers: []internal.ServerConfiguration{{URL: "https://csp.infoblox.com"}},
Servers: []internal.ServerConfiguration{{URL: "https://stage.csp.infoblox.com"}},
HTTPClient: http.DefaultClient,
DefaultTags: map[string]string{
clientIdentifier: "terraformv1.1#yug278872h",
Expand All @@ -100,13 +101,19 @@ func TestConfiguration_internal(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
var curEnvVal string
c := Configuration{
ClientName: tt.fields.ClientName,
CSPURL: tt.fields.CSPURL,
APIKey: tt.fields.APIKey,
HTTPClient: tt.fields.HTTPClient,
DefaultTags: tt.fields.DefaultTags,
}
if c.CSPURL != "" {
curEnvVal = os.Getenv(ENVBloxOneCSPURL)
t.Setenv(ENVBloxOneCSPURL, c.CSPURL)
}

got, err := c.internal(tt.args.basePath)
if (err != nil) != tt.wantErr {
t.Errorf("internal() error = %v, wantErr %v", err, tt.wantErr)
Expand All @@ -115,6 +122,12 @@ func TestConfiguration_internal(t *testing.T) {
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("internal() got = %v, want %v", got, tt.want)
}
t.Cleanup(func() {
// Set it to the value prior to executing the test
if c.CSPURL != "" {
t.Setenv(ENVBloxOneCSPURL, curEnvVal)
}
})
})
}
}
8 changes: 0 additions & 8 deletions infra_mgmt/api_hosts.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6c9cf17

Please sign in to comment.