Skip to content

Commit 5bf0b24

Browse files
committed
rm dead code
Signed-off-by: Charles-Edouard Brétéché <[email protected]>
1 parent a3a0482 commit 5bf0b24

File tree

12 files changed

+14
-33
lines changed

12 files changed

+14
-33
lines changed

.crds/chainsaw.kyverno.io_configurations.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,7 @@ spec:
845845
tests (implies SkipClusterDelete).
846846
type: boolean
847847
template:
848+
default: true
848849
description: Template determines whether resources should be considered
849850
for templating.
850851
type: boolean

.schemas/json/configuration-chainsaw-v1alpha1.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1646,7 +1646,8 @@
16461646
"type": [
16471647
"boolean",
16481648
"null"
1649-
]
1649+
],
1650+
"default": true
16501651
},
16511652
"testFile": {
16521653
"description": "TestFile is the name of the file containing the test to run.\nIf no extension is provided, chainsaw will try with .yaml first and .yml if needed.",

pkg/apis/conversion/configuration.go

+3-9
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func Convert_v1alpha2_ConfigurationSpec_To_v1alpha1_ConfigurationSpec(in *v1alph
2727
out.ReportPath = in.Path
2828
out.ReportName = in.Name
2929
}
30-
out.Template = &in.Templating.Enabled
30+
out.Template = in.Templating.Enabled
3131
out.Timeouts = in.Timeouts
3232
return nil
3333
}
@@ -65,14 +65,8 @@ func Convert_v1alpha1_ConfigurationSpec_To_v1alpha2_ConfigurationSpec(in *v1alph
6565
Path: in.ReportPath,
6666
Name: in.ReportName,
6767
}
68-
if in.Template == nil {
69-
out.Templating = v1alpha2.TemplatingOptions{
70-
Enabled: true,
71-
}
72-
} else {
73-
out.Templating = v1alpha2.TemplatingOptions{
74-
Enabled: *in.Template,
75-
}
68+
out.Templating = v1alpha2.TemplatingOptions{
69+
Enabled: in.Template,
7670
}
7771
out.Timeouts = in.Timeouts
7872
return nil

pkg/apis/v1alpha1/configuration.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ type ConfigurationSpec struct {
3434

3535
// Template determines whether resources should be considered for templating.
3636
// +optional
37-
Template *bool `json:"template,omitempty"`
37+
// +kubebuilder:default:=true
38+
Template bool `json:"template"`
3839

3940
// FailFast determines whether the test should stop upon encountering the first failure.
4041
// +optional

pkg/apis/v1alpha1/zz_generated.deepcopy.go

-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/commands/test/command.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/kyverno/chainsaw/pkg/loaders/values"
1515
"github.com/kyverno/chainsaw/pkg/runner"
1616
"github.com/kyverno/chainsaw/pkg/runner/failer"
17-
"github.com/kyverno/chainsaw/pkg/runner/template"
1817
flagutils "github.com/kyverno/chainsaw/pkg/utils/flag"
1918
fsutils "github.com/kyverno/chainsaw/pkg/utils/fs"
2019
restutils "github.com/kyverno/chainsaw/pkg/utils/rest"
@@ -349,7 +348,7 @@ func Command() *cobra.Command {
349348
// namespace options
350349
cmd.Flags().StringVar(&options.namespace, "namespace", "", "Namespace to use for tests")
351350
// templating options
352-
cmd.Flags().BoolVar(&options.template, "template", template.DefaultTemplate, "If set, resources will be considered for templating")
351+
cmd.Flags().BoolVar(&options.template, "template", config.Spec.Templating.Enabled, "If set, resources will be considered for templating")
353352
// cleanup options
354353
cmd.Flags().BoolVar(&options.skipDelete, "skip-delete", false, "If set, do not delete the resources after running the tests")
355354
cmd.Flags().DurationVar(&options.delayBeforeCleanup.Duration, "cleanup-delay", 0, "Adds a delay between the time a test ends and the time cleanup starts")

pkg/data/crds/chainsaw.kyverno.io_configurations.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,7 @@ spec:
845845
tests (implies SkipClusterDelete).
846846
type: boolean
847847
template:
848+
default: true
848849
description: Template determines whether resources should be considered
849850
for templating.
850851
type: boolean

pkg/data/schemas/json/configuration-chainsaw-v1alpha1.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1646,7 +1646,8 @@
16461646
"type": [
16471647
"boolean",
16481648
"null"
1649-
]
1649+
],
1650+
"default": true
16501651
},
16511652
"testFile": {
16521653
"description": "TestFile is the name of the file containing the test to run.\nIf no extension is provided, chainsaw will try with .yaml first and .yml if needed.",

pkg/runner/processors/step_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,6 @@ func TestStepProcessor_Run(t *testing.T) {
852852
}}
853853
for _, tc := range testCases {
854854
t.Run(tc.name, func(t *testing.T) {
855-
t.Parallel()
856855
registry := registryMock{}
857856
if tc.client != nil {
858857
registry.client = tc.client
@@ -874,7 +873,6 @@ func TestStepProcessor_Run(t *testing.T) {
874873
ctx = logging.IntoContext(ctx, &fakeLogger.FakeLogger{})
875874
tcontext := enginecontext.MakeContext(binding.NewBindings(), registry)
876875
stepProcessor.Run(ctx, tcontext)
877-
nt.Cleanup(func() {})
878876
if tc.expectedFail {
879877
assert.True(t, nt.FailedVar, "expected an error but got none")
880878
} else {

pkg/runner/template/template.go

-12
This file was deleted.

testdata/commands/migrate/kuttl/config/out.txt

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ metadata:
66
name: configuration
77
spec:
88
parallel: 4
9+
template: false
910
timeouts:
1011
apply: 5m0s
1112
assert: 5m0s

testdata/kuttl/.chainsaw.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ metadata:
66
name: configuration
77
spec:
88
parallel: 4
9+
template: false
910
timeouts:
1011
apply: 5m0s
1112
assert: 5m0s

0 commit comments

Comments
 (0)