Skip to content

Commit 743d34a

Browse files
committed
Code review suggestions
1 parent c62c170 commit 743d34a

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

manifest/provider/import_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,24 @@ func TestParseImportID(t *testing.T) {
4141
Err: fmt.Errorf("invalid format for import ID [%s]\nExpected format is: apiVersion=<value>,kind=<value>,name=<value>[,namespace=<value>]", "foobar"),
4242
},
4343
}
44-
for _, s := range samples {
45-
gotGvk, gotName, gotNamespace, gotErr := parseImportID(s.ID)
46-
if gotErr != nil {
47-
if gotErr.Error() == s.Err.Error() {
44+
for _, expected := range samples {
45+
actualGvk, actualName, actualNamespace, actualErr := parseImportID(expected.ID)
46+
if actualErr != nil {
47+
if actualErr.Error() == expected.Err.Error() {
4848
continue
4949
}
50-
t.Fatal(gotErr.Error())
50+
t.Fatal(actualErr.Error())
5151
}
52-
if s.GVK != gotGvk {
53-
t.Log("GVK (got / wanted):", gotGvk, s.GVK)
52+
if expected.GVK != actualGvk {
53+
t.Log("GVK (actual / wanted):", actualGvk, expected.GVK)
5454
t.Fail()
5555
}
56-
if s.Name != gotName {
57-
t.Log("Name (got / wanted):", gotName, s.Name)
56+
if expected.Name != actualName {
57+
t.Log("Name (actual / wanted):", actualName, expected.Name)
5858
t.Fail()
5959
}
60-
if s.Namespace != gotNamespace {
61-
t.Log("Namespace (got / wanted):", gotNamespace, s.Namespace)
60+
if expected.Namespace != actualNamespace {
61+
t.Log("Namespace (actual / wanted):", actualNamespace, expected.Namespace)
6262
t.Fail()
6363
}
6464
}

manifest/test/helper/kubernetes/kubernetes_helper.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build acceptance
12
// +build acceptance
23

34
package kubernetes
@@ -81,7 +82,7 @@ func (k *Helper) CreateNamespace(t *testing.T, name string) {
8182
}
8283
}
8384

84-
// CreateNamespace creates a new namespace
85+
// CreateConfigMap creates a new ConfigMap
8586
func (k *Helper) CreateConfigMap(t *testing.T, name string, namespace string, data map[string]interface{}) {
8687
t.Helper()
8788

@@ -103,7 +104,7 @@ func (k *Helper) CreateConfigMap(t *testing.T, name string, namespace string, da
103104
}
104105
}
105106

106-
// DeleteResource deletes a namespace
107+
// DeleteResource deletes a resource referred to by the name and GVK
107108
func (k *Helper) DeleteResource(t *testing.T, name string, gvr schema.GroupVersionResource) {
108109
t.Helper()
109110

@@ -113,7 +114,7 @@ func (k *Helper) DeleteResource(t *testing.T, name string, gvr schema.GroupVersi
113114
}
114115
}
115116

116-
// DeleteResource deletes a namespace
117+
// DeleteResource deletes a namespaced resource referred to by the name and GVK
117118
func (k *Helper) DeleteNamespacedResource(t *testing.T, name string, namespace string, gvr schema.GroupVersionResource) {
118119
t.Helper()
119120

website/docs/r/manifest.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ kubectl get secrets sample -o yaml | tfk8s --strip -o sample.tf
111111
### Import the resource state from the cluster
112112

113113
```
114-
terraform import kubernetes_manifest.secret_sample "v1#Secret#default#sample"
114+
terraform import kubernetes_manifest.secret_sample "apiVersion=v1,kind=Secret,namespace=default,name=sample"
115115
```
116116

117117
Note the import ID as the last argument to the import command. This ID points Terraform at which Kubernetes object to read when importing.

0 commit comments

Comments
 (0)