Skip to content

Commit ed6539a

Browse files
authored
Merge pull request #2039 from joelanford/fix/test-unit
🐛 fix unit tests to work with later versions of ginkgo/gomega
2 parents 33036c5 + c45c5da commit ed6539a

File tree

9 files changed

+113
-63
lines changed

9 files changed

+113
-63
lines changed

go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ go 1.15
44

55
require (
66
github.com/gobuffalo/flect v0.2.2
7-
github.com/onsi/ginkgo v1.12.0
8-
github.com/onsi/gomega v1.9.0
7+
github.com/onsi/ginkgo v1.15.0
8+
github.com/onsi/gomega v1.10.5
99
github.com/spf13/afero v1.2.2
1010
github.com/spf13/cobra v0.0.7
1111
github.com/spf13/pflag v1.0.5
12-
golang.org/x/tools v0.0.0-20200403190813-44a64ad78b9b
12+
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e
1313
sigs.k8s.io/yaml v1.2.0
1414
)

go.sum

+52-30
Large diffs are not rendered by default.

pkg/plugins/internal/filesystem/errors_test.go

-6
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,12 @@ package filesystem
1919
import (
2020
"errors"
2121
"path/filepath"
22-
"testing"
2322

2423
. "github.com/onsi/ginkgo"
2524
. "github.com/onsi/ginkgo/extensions/table"
2625
. "github.com/onsi/gomega"
2726
)
2827

29-
func TestErrors(t *testing.T) {
30-
RegisterFailHandler(Fail)
31-
RunSpecs(t, "Error suite")
32-
}
33-
3428
var _ = Describe("Errors", func() {
3529
var (
3630
path = filepath.Join("path", "to", "file")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
Copyright 2021 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package filesystem
18+
19+
import (
20+
"testing"
21+
22+
. "github.com/onsi/ginkgo"
23+
. "github.com/onsi/gomega"
24+
)
25+
26+
func TestFilesystem(t *testing.T) {
27+
RegisterFailHandler(Fail)
28+
RunSpecs(t, "Filesystem suite")
29+
}

pkg/plugins/internal/filesystem/filesystem_test.go

-6
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,11 @@ package filesystem
1818

1919
import (
2020
"os"
21-
"testing"
2221

2322
. "github.com/onsi/ginkgo"
2423
. "github.com/onsi/gomega"
2524
)
2625

27-
func TestFileSystem(t *testing.T) {
28-
RegisterFailHandler(Fail)
29-
RunSpecs(t, "FileSystem suite")
30-
}
31-
3226
var _ = Describe("FileSystem", func() {
3327
Describe("New", func() {
3428
const (

pkg/plugins/internal/filesystem/mock_test.go

-6
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,11 @@ import (
2020
"bytes"
2121
"errors"
2222
"path/filepath"
23-
"testing"
2423

2524
. "github.com/onsi/ginkgo"
2625
. "github.com/onsi/gomega"
2726
)
2827

29-
func TestMockFileSystem(t *testing.T) {
30-
RegisterFailHandler(Fail)
31-
RunSpecs(t, "MockFileSystem suite")
32-
}
33-
3428
//nolint:dupl
3529
var _ = Describe("MockFileSystem", func() {
3630
var (

pkg/plugins/internal/machinery/errors_test.go

-6
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,12 @@ package machinery
1919
import (
2020
"errors"
2121
"path/filepath"
22-
"testing"
2322

2423
. "github.com/onsi/ginkgo"
2524
. "github.com/onsi/ginkgo/extensions/table"
2625
. "github.com/onsi/gomega"
2726
)
2827

29-
func TestErrors(t *testing.T) {
30-
RegisterFailHandler(Fail)
31-
RunSpecs(t, "Error suite")
32-
}
33-
3428
var _ = Describe("Errors", func() {
3529
var (
3630
path = filepath.Join("path", "to", "file")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
Copyright 2021 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package machinery
18+
19+
import (
20+
"testing"
21+
22+
. "github.com/onsi/ginkgo"
23+
. "github.com/onsi/gomega"
24+
)
25+
26+
func TestMachinery(t *testing.T) {
27+
RegisterFailHandler(Fail)
28+
RunSpecs(t, "Machinery suite")
29+
}

pkg/plugins/internal/machinery/scaffold_test.go

-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package machinery
1717
import (
1818
"bytes"
1919
"errors"
20-
"testing"
2120

2221
. "github.com/onsi/ginkgo"
2322
. "github.com/onsi/ginkgo/extensions/table"
@@ -28,11 +27,6 @@ import (
2827
"sigs.k8s.io/kubebuilder/v3/pkg/plugins/internal/filesystem"
2928
)
3029

31-
func TestScaffold(t *testing.T) {
32-
RegisterFailHandler(Fail)
33-
RunSpecs(t, "Scaffold suite")
34-
}
35-
3630
var _ = Describe("Scaffold", func() {
3731
Describe("NewScaffold", func() {
3832
var (

0 commit comments

Comments
 (0)