-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19494 from findkim/provider-alias
Use registry alias to fetch providers
- Loading branch information
Showing
5 changed files
with
83 additions
and
8 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
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,48 @@ | ||
package regsrc | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestNewTerraformProviderNamespace(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
provider string | ||
expectedNamespace string | ||
expectedName string | ||
}{ | ||
{ | ||
name: "default", | ||
provider: "null", | ||
expectedNamespace: "-", | ||
expectedName: "null", | ||
}, { | ||
name: "explicit", | ||
provider: "terraform-providers/null", | ||
expectedNamespace: "terraform-providers", | ||
expectedName: "null", | ||
}, { | ||
name: "community", | ||
provider: "community-providers/null", | ||
expectedNamespace: "community-providers", | ||
expectedName: "null", | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
actual := NewTerraformProvider(tt.provider, "", "") | ||
|
||
if actual == nil { | ||
t.Fatal("NewTerraformProvider() unexpectedly returned nil provider") | ||
} | ||
|
||
if v := actual.RawNamespace; v != tt.expectedNamespace { | ||
t.Fatalf("RawNamespace = %v, wanted %v", v, tt.expectedNamespace) | ||
} | ||
if v := actual.RawName; v != tt.expectedName { | ||
t.Fatalf("RawName = %v, wanted %v", v, tt.expectedName) | ||
} | ||
}) | ||
} | ||
} |
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