Skip to content

Commit

Permalink
Merge pull request cri-o#7888 from saschagrunert/ginkgolinter
Browse files Browse the repository at this point in the history
Enable and fix `ginkgolinter` reports
  • Loading branch information
openshift-merge-bot[bot] committed Mar 14, 2024
2 parents 227330d + 511572c commit 514b618
Show file tree
Hide file tree
Showing 95 changed files with 1,245 additions and 1,245 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ linters:
- execinquery
- exportloopref
- forcetypeassert
- ginkgolinter
- gocheckcompilerdirectives
- gochecknoinits
- gochecksumtype
Expand Down Expand Up @@ -85,7 +86,6 @@ linters:
# - forbidigo
# - funlen
# - gci
# - ginkgolinter
# - gochecknoglobals
# - gocognit
# - godot
Expand Down
2 changes: 1 addition & 1 deletion internal/config/apparmor/apparmor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var _ = t.Describe("Config", func() {
err := sut.LoadProfile("unconfined")

// Then
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
})
})
})
8 changes: 4 additions & 4 deletions internal/config/blockio/blockio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func tempFileWithData(data string) string {
f := t.MustTempFile("")
Expect(os.WriteFile(f, []byte(data), 0o644)).To(BeNil())
Expect(os.WriteFile(f, []byte(data), 0o644)).To(Succeed())
return f
}

Expand Down Expand Up @@ -42,7 +42,7 @@ var _ = t.Describe("Load", func() {
err := sut.Load("non-existent-file")

// Then
Expect(err).NotTo(BeNil())
Expect(err).To(HaveOccurred())
Expect(sut.Enabled()).To(BeFalse())
})
})
Expand All @@ -59,7 +59,7 @@ var _ = t.Describe("Load", func() {
err := sut.Load(f)

// Then
Expect(err).NotTo(BeNil())
Expect(err).To(HaveOccurred())
Expect(sut.Enabled()).To(BeFalse())
})
})
Expand All @@ -80,7 +80,7 @@ var _ = t.Describe("Load", func() {
err := sut.Load(f)

// Then
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(sut.Enabled()).To(BeTrue())
})
})
Expand Down
6 changes: 3 additions & 3 deletions internal/config/capabilities/capabilities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var _ = t.Describe("Capabilities", func() {
err := sut.Validate()

// Then
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
})

It("should succeed to validate wrong case capabilities", func() {
Expand All @@ -27,7 +27,7 @@ var _ = t.Describe("Capabilities", func() {
err := sut.Validate()

// Then
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
})

It("should fail to validate wrong capabilities", func() {
Expand All @@ -38,6 +38,6 @@ var _ = t.Describe("Capabilities", func() {
err := sut.Validate()

// Then
Expect(err).NotTo(BeNil())
Expect(err).To(HaveOccurred())
})
})
32 changes: 16 additions & 16 deletions internal/config/cgmgr/cgmgr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var _ = t.Describe("Cgmgr", func() {

// Then
Expect(sut).To(Not(BeNil()))
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
})
It("should be able to be set to systemd", func() {
// Given
Expand All @@ -50,7 +50,7 @@ var _ = t.Describe("Cgmgr", func() {

// Then
Expect(sut).To(Not(BeNil()))
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
})
It("should fail when invalid", func() {
// Given
Expand All @@ -60,7 +60,7 @@ var _ = t.Describe("Cgmgr", func() {

// Then
Expect(sut).To(BeNil())
Expect(err).To(Not(BeNil()))
Expect(err).To(HaveOccurred())
})
})
t.Describe("Name", func() {
Expand All @@ -77,7 +77,7 @@ var _ = t.Describe("Cgmgr", func() {
var err error
sut, err = cgmgr.SetCgroupManager(cgroupfsManager)
Expect(sut).To(Not(BeNil()))
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
// When
name := sut.Name()

Expand All @@ -92,19 +92,19 @@ var _ = t.Describe("Cgmgr", func() {
res := sut.IsSystemd()

// Then
Expect(res).To(Equal(true))
Expect(res).To(BeTrue())
})
It("should be able to be set to cgroupfs", func() {
// Given
var err error
sut, err = cgmgr.SetCgroupManager(cgroupfsManager)
Expect(sut).To(Not(BeNil()))
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
// When
res := sut.IsSystemd()

// Then
Expect(res).To(Equal(false))
Expect(res).To(BeFalse())
})
})
t.Describe("CgroupfsManager", func() {
Expand Down Expand Up @@ -141,7 +141,7 @@ var _ = t.Describe("Cgmgr", func() {
// Then
Expect(cgParent).To(BeEmpty())
Expect(cgPath).To(BeEmpty())
Expect(err).To(Not(BeNil()))
Expect(err).To(HaveOccurred())
})
It("can override sandbox parent", func() {
// Given
Expand All @@ -152,7 +152,7 @@ var _ = t.Describe("Cgmgr", func() {
Expect(cgParent).To(Equal(genericSandboxParent))
Expect(cgPath).To(ContainSubstring(genericSandboxParent))
Expect(cgPath).To(ContainSubstring(sbID))
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
})
})
t.Describe("MoveConmonToCgroup", func() {
Expand All @@ -164,7 +164,7 @@ var _ = t.Describe("Cgmgr", func() {

// Then
Expect(cgPath).To(BeEmpty())
Expect(err).To(Not(BeNil()))
Expect(err).To(HaveOccurred())
})
})
})
Expand Down Expand Up @@ -195,7 +195,7 @@ var _ = t.Describe("Cgmgr", func() {
// When
cgroupPath, err := sut.ContainerCgroupAbsolutePath("", cID)
// Then
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(cgroupPath).To(ContainSubstring(cID))
Expect(cgroupPath).To(ContainSubstring("system.slice"))
})
Expand All @@ -204,15 +204,15 @@ var _ = t.Describe("Cgmgr", func() {
// When
cgroupPath, err := sut.ContainerCgroupAbsolutePath("", cID)
// Then
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(filepath.IsAbs(cgroupPath)).To(BeTrue())
})
It("should fail to expand slice", func() {
// Given
// When
cgroupPath, err := sut.ContainerCgroupAbsolutePath("::::", cID)
// Then
Expect(err).To(Not(BeNil()))
Expect(err).To(HaveOccurred())
Expect(cgroupPath).To(Equal(""))
})
})
Expand All @@ -226,7 +226,7 @@ var _ = t.Describe("Cgmgr", func() {
// Then
Expect(cgParent).To(BeEmpty())
Expect(cgPath).To(BeEmpty())
Expect(err).To(Not(BeNil()))
Expect(err).To(HaveOccurred())
})
It("should fail when parent not slice", func() {
// Given
Expand All @@ -237,7 +237,7 @@ var _ = t.Describe("Cgmgr", func() {
// Then
Expect(cgParent).To(BeEmpty())
Expect(cgPath).To(BeEmpty())
Expect(err).To(Not(BeNil()))
Expect(err).To(HaveOccurred())
})
})
t.Describe("MoveConmonToCgroup", func() {
Expand All @@ -249,7 +249,7 @@ var _ = t.Describe("Cgmgr", func() {

// Then
Expect(cgPath).To(BeEmpty())
Expect(err).To(Not(BeNil()))
Expect(err).To(HaveOccurred())
})
})
})
Expand Down
Loading

0 comments on commit 514b618

Please sign in to comment.