-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6623fc6
commit c90c65c
Showing
9 changed files
with
624 additions
and
505 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,46 @@ | ||
// Copyright 2016-2024, Pulumi Corporation. | ||
|
||
package provider | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestInstanceTypeName(t *testing.T) { | ||
type testCase struct { | ||
Value string | ||
Name string | ||
} | ||
|
||
testCases := []testCase{ | ||
{Name: "A1_2XLarge", Value: "a1.2xlarge"}, | ||
{Name: "A1_Metal", Value: "a1.metal"}, | ||
{Name: "C6a_Large", Value: "c6a.large"}, | ||
{Name: "C7g_Medium", Value: "c7g.medium"}, | ||
{Name: "M1_Small", Value: "m1.small"}, | ||
{Name: "M7a_Metal", Value: "m7a.metal-48xl"}, | ||
{Name: "T1_Micro", Value: "t1.micro"}, | ||
{Name: "T2_Nano", Value: "t2.nano"}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
actual, err := instanceTypeName(tc.Value) | ||
assert.NoError(t, err) | ||
assert.Equal(t, tc.Name, actual) | ||
} | ||
} | ||
|
||
func TestInstanceTypeNameErr(t *testing.T) { | ||
testCases := []string{ | ||
"a1.metal.pc", | ||
"m7a.metal-96xl", | ||
} | ||
|
||
for _, tc := range testCases { | ||
actual, err := instanceTypeName(tc) | ||
assert.Error(t, err) | ||
assert.Equal(t, "", actual) | ||
} | ||
} |
Oops, something went wrong.