Skip to content

Commit 29995c8

Browse files
committed
Updates the kind in some of the unit tests
1 parent 0f4a137 commit 29995c8

File tree

3 files changed

+24
-25
lines changed

3 files changed

+24
-25
lines changed

pkg/storage/kubernetes.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ type kubernetesClient struct {
3232
func (k kubernetesClient) Create(storage Storage) error {
3333

3434
if k.componentName == "" || k.appName == "" {
35-
// required for generating the labels
36-
return fmt.Errorf("the component name, the app name or both are empty")
35+
return fmt.Errorf("the component name and the app name should be provided")
3736
}
3837

3938
pvcName, err := generatePVCName(storage.Name, k.componentName, k.appName)

pkg/storage/utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func GetMachineReadableFormat(storageName, storageSize, storagePath string) Stor
5858
// storagePath indicates the path to which the storage is mounted to, "" if not mounted
5959
func GetMachineFormatWithContainer(storageName, storageSize, storagePath string, container string) Storage {
6060
storage := Storage{
61-
TypeMeta: metav1.TypeMeta{Kind: "storage", APIVersion: apiVersion},
61+
TypeMeta: metav1.TypeMeta{Kind: "Storage", APIVersion: apiVersion},
6262
ObjectMeta: metav1.ObjectMeta{Name: storageName},
6363
Spec: StorageSpec{
6464
Size: storageSize,
@@ -104,7 +104,7 @@ func ConvertListLocalToMachine(storageListConfig []localConfigProvider.LocalStor
104104
func MachineReadableSuccessOutput(storageName string, message string) {
105105
machineOutput := machineoutput.GenericSuccess{
106106
TypeMeta: metav1.TypeMeta{
107-
Kind: "storage",
107+
Kind: "Storage",
108108
APIVersion: apiVersion,
109109
},
110110
ObjectMeta: metav1.ObjectMeta{

pkg/storage/utils_test.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,38 @@ import (
99

1010
func TestGetMachineReadableFormat(t *testing.T) {
1111
tests := []struct {
12-
name string
13-
storageName string
14-
storageSize string
15-
mountedPath string
16-
want Storage
12+
name string
13+
storageName string
14+
storageSize string
15+
mountedPath string
16+
want Storage
1717
}{
1818
{
19-
name: "test case 1: with a pvc, valid path and mounted status",
20-
storageName: "pvc-example",
21-
storageSize: "100Mi",
22-
mountedPath: "data",
19+
name: "test case 1: with a pvc, valid path and mounted status",
20+
storageName: "pvc-example",
21+
storageSize: "100Mi",
22+
mountedPath: "data",
2323
want: Storage{
2424
ObjectMeta: metav1.ObjectMeta{
2525
Name: "pvc-example",
2626
},
27-
TypeMeta: metav1.TypeMeta{Kind: "storage", APIVersion: "odo.dev/v1alpha1"},
27+
TypeMeta: metav1.TypeMeta{Kind: "Storage", APIVersion: "odo.dev/v1alpha1"},
2828
Spec: StorageSpec{
2929
Size: "100Mi",
3030
Path: "data",
3131
},
3232
},
3333
},
3434
{
35-
name: "test case 2: with a pvc, empty path and unmounted status",
36-
storageName: "pvc-example",
37-
storageSize: "500Mi",
38-
mountedPath: "",
35+
name: "test case 2: with a pvc, empty path and unmounted status",
36+
storageName: "pvc-example",
37+
storageSize: "500Mi",
38+
mountedPath: "",
3939
want: Storage{
4040
ObjectMeta: metav1.ObjectMeta{
4141
Name: "pvc-example",
4242
},
43-
TypeMeta: metav1.TypeMeta{Kind: "storage", APIVersion: "odo.dev/v1alpha1"},
43+
TypeMeta: metav1.TypeMeta{Kind: "Storage", APIVersion: "odo.dev/v1alpha1"},
4444
Spec: StorageSpec{
4545
Size: "500Mi",
4646
Path: "",
@@ -73,7 +73,7 @@ func TestGetMachineReadableFormatForList(t *testing.T) {
7373
Name: "example-pvc-1",
7474
},
7575
TypeMeta: metav1.TypeMeta{
76-
Kind: "List",
76+
Kind: "Storage",
7777
APIVersion: "odo.dev/v1alpha1",
7878
},
7979
Spec: StorageSpec{
@@ -94,7 +94,7 @@ func TestGetMachineReadableFormatForList(t *testing.T) {
9494
Name: "example-pvc-1",
9595
},
9696
TypeMeta: metav1.TypeMeta{
97-
Kind: "List",
97+
Kind: "Storage",
9898
APIVersion: "odo.dev/v1alpha1",
9999
},
100100
Spec: StorageSpec{
@@ -113,7 +113,7 @@ func TestGetMachineReadableFormatForList(t *testing.T) {
113113
Name: "example-pvc-0",
114114
},
115115
TypeMeta: metav1.TypeMeta{
116-
Kind: "List",
116+
Kind: "Storage",
117117
APIVersion: "odo.dev/v1alpha1",
118118
},
119119
Spec: StorageSpec{
@@ -126,7 +126,7 @@ func TestGetMachineReadableFormatForList(t *testing.T) {
126126
Name: "example-pvc-1",
127127
},
128128
TypeMeta: metav1.TypeMeta{
129-
Kind: "List",
129+
Kind: "Storage",
130130
APIVersion: "odo.dev/v1alpha1",
131131
},
132132
Spec: StorageSpec{
@@ -147,7 +147,7 @@ func TestGetMachineReadableFormatForList(t *testing.T) {
147147
Name: "example-pvc-0",
148148
},
149149
TypeMeta: metav1.TypeMeta{
150-
Kind: "List",
150+
Kind: "Storage",
151151
APIVersion: "odo.dev/v1alpha1",
152152
},
153153
Spec: StorageSpec{
@@ -160,7 +160,7 @@ func TestGetMachineReadableFormatForList(t *testing.T) {
160160
Name: "example-pvc-1",
161161
},
162162
TypeMeta: metav1.TypeMeta{
163-
Kind: "List",
163+
Kind: "Storage",
164164
APIVersion: "odo.dev/v1alpha1",
165165
},
166166
Spec: StorageSpec{

0 commit comments

Comments
 (0)