Skip to content

Commit

Permalink
fcos/v1_6_exp: Remove validations
Browse files Browse the repository at this point in the history
  • Loading branch information
yasminvalim committed Jan 16, 2024
1 parent 6695988 commit 5086831
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 64 deletions.
12 changes: 0 additions & 12 deletions config/fcos/v1_6_exp/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,3 @@ func (user GrubUser) Validate(c path.ContextPath) (r report.Report) {
}
return
}

func (m Module) Validate(c path.ContextPath) (r report.Report) {
if m.Name == "" {
r.AddOnError(c.Append("name"), common.ErrSelinuxNameNotSpecified)
}

if m.Contents.Inline == nil || *m.Contents.Inline == "" {
r.AddOnError(c.Append("contents"), common.ErrSelinuxContentsNotSpecified)
}

return r
}
52 changes: 0 additions & 52 deletions config/fcos/v1_6_exp/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,55 +479,3 @@ func TestValidateConfig(t *testing.T) {
})
}
}

func TestValidateModule(t *testing.T) {
tests := []struct {
in Module
out error
errPath path.ContextPath
}{
{
// valid module
in: Module{
Contents: Resource{
Inline: util.StrToPtr("some contents"),
},
Name: "some name",
},
out: nil,
errPath: path.New("yaml"),
},
{
// contents is not specified
in: Module{
Contents: Resource{
Inline: util.StrToPtr(""),
},
Name: "some name",
},
out: common.ErrSelinuxContentsNotSpecified,
errPath: path.New("yaml", "contents"),
},
{
// name is not specified
in: Module{
Name: "",
Contents: Resource{
Inline: util.StrToPtr("some contents"),
},
},
out: common.ErrSelinuxNameNotSpecified,
errPath: path.New("yaml", "name"),
},
}

for i, test := range tests {
t.Run(fmt.Sprintf("validate %d", i), func(t *testing.T) {
actual := test.in.Validate(path.New("yaml"))
baseutil.VerifyReport(t, test.in, actual)
expected := report.Report{}
expected.AddOnError(test.errPath, test.out)
assert.Equal(t, expected, actual, "bad report")
})
}
}

0 comments on commit 5086831

Please sign in to comment.