Skip to content

Commit

Permalink
Added test case
Browse files Browse the repository at this point in the history
Signed-off-by: Marcus Noble <[email protected]>
  • Loading branch information
AverageMarcus committed Apr 29, 2024
1 parent 34f5d22 commit 39e178e
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 0 deletions.
19 changes: 19 additions & 0 deletions kubeconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM2akNDQWRLZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJME1EUXlPVEE0TlRZME9Gb1hEVE0wTURReU56QTVNREUwT0Zvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBS1lJClFXY01NMWNKNnlkeG5JOHdIMkVheit2NmZTbVorcm51WmZDVVJETmF2bTFaQmp5WXBLWnhUeEdjaEpmUXhGVVAKWS9wdFFKRzg3c1czZzN6YkJlNTAyTTNRaE1XbzNBMi8yVXB3VWNobzIvVk9uUFp1aUxOc1BHV3BFWllDWUxtWQpWV0tBR3ZDNUFPYVU4OExsRlNzUnpJMGE2RW9ZT0NRR1ZLdzhYTWVhYk1maG90dGtBeVhzZ3F5NHpWKzc3RzdTCjVPMHdjc3JYZGJtR1V3MVp6djdDS0NzVzRHU2JRR2w5SmNjS1Z3ZTlNYXZacUt1TU96NjJnWDR4aVl1QzJkZ0IKZzV1cFB2dm1CV1NxY3BOamdxYVlTSmtDWHN2WUxwdHRpdTE2ZFdyaC93TzZHTFZIQ2RHZEwyczRRemp1dXhSYwpLbkNjbGlEMlNNbmhDVWNPQVhNQ0F3RUFBYU5GTUVNd0RnWURWUjBQQVFIL0JBUURBZ0trTUJJR0ExVWRFd0VCCi93UUlNQVlCQWY4Q0FRQXdIUVlEVlIwT0JCWUVGTnVVTkhyR3ppTFhxOSs4alFRY096cTNqampsTUEwR0NTcUcKU0liM0RRRUJDd1VBQTRJQkFRQnhVWWtwRGozRUlwK2VDZktxYm1QdE5rWTc3dlFaNTQ2a3RjZnZBUXp3dk40MwpEQ20xSW9SN2QzT1JrUitXRlFzanF2RUxlZ29lV3lpcVVpa29BNGcxcjFKQUYrazdFNmNDbDF4NVE2eWkxT1IxCjlnaUVWaEVaQ3VjT3k0VzN5TllzalJybmZ1WGlwbldFT1VOeTIxcGpjaklLbVJvN1RjV254MC9xN2lpeGIxa2MKcjVEaWZzSWtxREhsMVU0emlBU0RnRTJINVhHZmNaNXg2RWJPRStKdStaRXRwM0ZKZ2dwc3dTa2Jyai9ZeDJFYwpNNmUvWVBEY0g2blNKb0R4WHQ3NjVjNnY2WDJjUFU3a2hXeEU5WFVXNzVFVlJVc0p6Y3BYSXhXdFdMdy85ZWcvCll0N2FhLzI5RWhvMUFiK2lENkVtZ0p3UnV5SnlMT1R3RFJzTC93dlMKLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
server: https://api.t-mk554ltorh0w8n8is8.gaws.gigantic.io:443
name: t-mk554ltorh0w8n8is8
contexts:
- context:
cluster: t-mk554ltorh0w8n8is8
user: t-mk554ltorh0w8n8is8-admin
name: t-mk554ltorh0w8n8is8-admin@t-mk554ltorh0w8n8is8
current-context: t-mk554ltorh0w8n8is8-admin@t-mk554ltorh0w8n8is8
kind: Config
preferences: {}
users:
- name: t-mk554ltorh0w8n8is8-admin
user:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURFekNDQWZ1Z0F3SUJBZ0lJVStwUU14YVZCYjh3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRBME1qa3dPRFUyTkRoYUZ3MHlOVEEwTWprd09UQXhOR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pcm1WZktEU1MwbWx4MGRPaTRkbXQyZjJQSgpGcEV1UlVrdGxPTmpObDV3SkwzUGNHRXFDK3I5K1k2U1FNaGRpcWJGK2hMMUpHVm5rdU9zVEZFYkIvQS9RZ2RFCkc2Y0RWd0tCZ0RPTHpmS0ErdWJFalFPMjBkNEdLQ0NOZVVQbkxETzlKdlBIQW91T3hURm5pZTl3MDJRUktoMmIKQ0xvV1Jxajk3T1VocElndlBTRHJla1puOHdzQXV0ZnMyWjBCVEtnQVliYitJODcrRXp3RDF1WkgvS0cxekN4ZQpiWU5jb0tDOWY3OUFIeTFFc2RKc3YwekUyMGdCVDJENnVuU1ZJanhHU1JpaHg4MTZlQmJ4Ci0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==
78 changes: 78 additions & 0 deletions pkg/clusterbuilder/client_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package clusterbuilder

import (
"testing"

"github.com/giantswarm/cluster-standup-teardown/pkg/clusterbuilder/providers/capa"
"github.com/giantswarm/cluster-standup-teardown/pkg/clusterbuilder/providers/capv"
"github.com/giantswarm/cluster-standup-teardown/pkg/clusterbuilder/providers/capvcd"
"github.com/giantswarm/cluster-standup-teardown/pkg/clusterbuilder/providers/capz"
)

func Test_GetClusterBuilderForContext(t *testing.T) {
tests := []struct {
inputValues string
expected ClusterBuilder
expectedError bool
}{
{
inputValues: "capa",
expected: &capa.ClusterBuilder{},
expectedError: false,
},
{
inputValues: "capa-private-proxy",
expected: &capa.PrivateClusterBuilder{},
expectedError: false,
},
{
inputValues: "eks",
expected: &capa.ManagedClusterBuilder{},
expectedError: false,
},
{
inputValues: "capv",
expected: &capv.ClusterBuilder{},
expectedError: false,
},
{
inputValues: "capvcd",
expected: &capvcd.ClusterBuilder{},
expectedError: false,
},
{
inputValues: "capz",
expected: &capz.ClusterBuilder{},
expectedError: false,
},
{
inputValues: "CAPA",
expected: &capa.ClusterBuilder{},
expectedError: false,
},
{
inputValues: "unknown",
expected: nil,
expectedError: true,
},
{
inputValues: "",
expected: nil,
expectedError: true,
},
}

for _, tc := range tests {
t.Run(tc.inputValues, func(t *testing.T) {
cb, err := GetClusterBuilderForContext(tc.inputValues)

if err != nil && !tc.expectedError {
t.Fatalf("unexpected error: %v", err)
}

if cb != tc.expected {
t.Fatalf("Actual value didn't match expected value\n\nexpected: %q\n\nactual: %q", tc.expected, cb)
}
})
}
}
1 change: 1 addition & 0 deletions results.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"provider":"aws","clusterName":"t-mk554ltorh0w8n8is8","orgName":"t-4usqtub1jvk9l63lun","namespace":"org-t-4usqtub1jvk9l63lun","clusterVersion":"latest","kubeconfigPath":"kubeconfig"}

0 comments on commit 39e178e

Please sign in to comment.