Skip to content

Commit ade91c8

Browse files
author
Valeriy Khorunzhin
committed
fix linter
Signed-off-by: Valeriy Khorunzhin <[email protected]>
1 parent c1cd483 commit ade91c8

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

images/virtualization-artifact/pkg/controller/vm/internal/validators/first_block_device_validator.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ import (
2929
)
3030

3131
const (
32-
viMainErrorMessage = "A non-CDROM VirtualImage cannot occupy the first position in block devices"
33-
cviMainErrorMessage = "A non-CDROM ClusterVirtualImage cannot occupy the first position in block devices"
34-
cannotCheckViMessage = "Unable to verify if the specified VirtualImage is a CDROM"
35-
cannotCheckCviMessage = "Unable to verify if the specified ClusterVirtualImage is a CDROM"
32+
viMainErrorMessage = "a non-CDROM VirtualImage cannot occupy the first position in block devices"
33+
cviMainErrorMessage = "a non-CDROM ClusterVirtualImage cannot occupy the first position in block devices"
34+
cannotCheckViMessage = "unable to verify if the specified VirtualImage is a CDROM"
35+
cannotCheckCviMessage = "unable to verify if the specified ClusterVirtualImage is a CDROM"
3636
)
3737

3838
type FirstBlockDeviceValidator struct {

images/virtualization-artifact/pkg/controller/vm/internal/validators/first_block_device_validator_test.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ limitations under the License.
1717
package validators_test
1818

1919
import (
20-
. "github.com/onsi/ginkgo/v2"
21-
. "github.com/onsi/gomega"
22-
2320
"errors"
2421

22+
. "github.com/onsi/ginkgo/v2"
23+
. "github.com/onsi/gomega"
2524
"sigs.k8s.io/controller-runtime/pkg/client"
2625

2726
cvibuilder "github.com/deckhouse/virtualization-controller/pkg/builder/cvi"
@@ -78,7 +77,7 @@ var _ = DescribeTable("TestFirstBlockDeviceValidator", func(args firstBlockDevic
7877
Objects: []client.Object{
7978
generateVI("vi1", "ns", v1alpha2.ImageReady, false),
8079
},
81-
ExpectedError: errors.New("A non-CDROM VirtualImage cannot occupy the first position in block devices: VirtualImage vi1 is not CDROM"),
80+
ExpectedError: errors.New("a non-CDROM VirtualImage cannot occupy the first position in block devices: VirtualImage vi1 is not CDROM"),
8281
}),
8382
Entry("Has not ready VI as first device", firstBlockDeviceValidatorTestArgs{
8483
VM: generateVM("vm1", "ns", v1alpha2.BlockDeviceSpecRef{
@@ -88,14 +87,14 @@ var _ = DescribeTable("TestFirstBlockDeviceValidator", func(args firstBlockDevic
8887
Objects: []client.Object{
8988
generateVI("vi1", "ns", v1alpha2.ImagePending, false),
9089
},
91-
ExpectedError: errors.New("A non-CDROM VirtualImage cannot occupy the first position in block devices: Unable to verify if the specified VirtualImage is a CDROM: VirtualImage vi1 is not ready"),
90+
ExpectedError: errors.New("a non-CDROM VirtualImage cannot occupy the first position in block devices: unable to verify if the specified VirtualImage is a CDROM: VirtualImage vi1 is not ready"),
9291
}),
9392
Entry("Has not exists vi as first device", firstBlockDeviceValidatorTestArgs{
9493
VM: generateVM("vm1", "ns", v1alpha2.BlockDeviceSpecRef{
9594
Kind: v1alpha2.ImageDevice,
9695
Name: "vi1",
9796
}),
98-
ExpectedError: errors.New("A non-CDROM VirtualImage cannot occupy the first position in block devices: Unable to verify if the specified VirtualImage is a CDROM: VirtualImage vi1 does not exist"),
97+
ExpectedError: errors.New("a non-CDROM VirtualImage cannot occupy the first position in block devices: unable to verify if the specified VirtualImage is a CDROM: VirtualImage vi1 does not exist"),
9998
}),
10099
Entry("Has CRDOM CVI as first device", firstBlockDeviceValidatorTestArgs{
101100
VM: generateVM("vm1", "ns", v1alpha2.BlockDeviceSpecRef{
@@ -115,31 +114,31 @@ var _ = DescribeTable("TestFirstBlockDeviceValidator", func(args firstBlockDevic
115114
Objects: []client.Object{
116115
generateCVI("cvi1", v1alpha2.ImageReady, false),
117116
},
118-
ExpectedError: errors.New("A non-CDROM ClusterVirtualImage cannot occupy the first position in block devices: ClusterVirtualImage cvi1 is not CDROM"),
117+
ExpectedError: errors.New("a non-CDROM ClusterVirtualImage cannot occupy the first position in block devices: ClusterVirtualImage cvi1 is not CDROM"),
119118
}),
120119
Entry("Has not ready CVI as first device", firstBlockDeviceValidatorTestArgs{
121-
VM: generateVM("vm1", "ns", v1alpha2.BlockDeviceSpecRef{
120+
VM: generateVM("vm1", "ns1", v1alpha2.BlockDeviceSpecRef{
122121
Kind: v1alpha2.ClusterImageDevice,
123122
Name: "cvi1",
124123
}),
125124
Objects: []client.Object{
126125
generateCVI("cvi1", v1alpha2.ImagePending, false),
127126
},
128-
ExpectedError: errors.New("A non-CDROM ClusterVirtualImage cannot occupy the first position in block devices: Unable to verify if the specified ClusterVirtualImage is a CDROM: ClusterVirtualImage cvi1 is not ready"),
127+
ExpectedError: errors.New("a non-CDROM ClusterVirtualImage cannot occupy the first position in block devices: unable to verify if the specified ClusterVirtualImage is a CDROM: ClusterVirtualImage cvi1 is not ready"),
129128
}),
130129
Entry("Has not exists CVI as first device", firstBlockDeviceValidatorTestArgs{
131-
VM: generateVM("vm1", "ns", v1alpha2.BlockDeviceSpecRef{
130+
VM: generateVM("vm", "ns", v1alpha2.BlockDeviceSpecRef{
132131
Kind: v1alpha2.ClusterImageDevice,
133132
Name: "cvi1",
134133
}),
135-
ExpectedError: errors.New("A non-CDROM ClusterVirtualImage cannot occupy the first position in block devices: Unable to verify if the specified ClusterVirtualImage is a CDROM: ClusterVirtualImage cvi1 does not exist"),
134+
ExpectedError: errors.New("a non-CDROM ClusterVirtualImage cannot occupy the first position in block devices: unable to verify if the specified ClusterVirtualImage is a CDROM: ClusterVirtualImage cvi1 does not exist"),
136135
}),
137136
)
138137

139138
func setupEnvironment(objs ...client.Object) client.Client {
140139
GinkgoHelper()
141140

142-
var allObjects []client.Object = []client.Object{}
141+
var allObjects []client.Object
143142
allObjects = append(allObjects, objs...)
144143

145144
fakeClient, err := testutil.NewFakeClientWithObjects(allObjects...)

0 commit comments

Comments
 (0)