Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nieomylnieja committed Aug 9, 2024
1 parent 320f5a5 commit 1256b1a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions pkg/govy/plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type PodStatus struct {
}

func TestPlan(t *testing.T) {
metadataValidator := govy.New[PodMetadata](
metadataValidator := govy.New(
govy.For(func(p PodMetadata) string { return p.Name }).
WithName("name").
Required().
Expand All @@ -84,7 +84,7 @@ func TestPlan(t *testing.T) {
),
)

specValidator := govy.New[PodSpec](
specValidator := govy.New(
govy.For(func(p PodSpec) string { return p.DNSPolicy }).
WithName("dnsPolicy").
Required().
Expand All @@ -95,7 +95,7 @@ func TestPlan(t *testing.T) {
rules.SliceMaxLength[[]Container](10),
rules.SliceUnique(func(c Container) string { return c.Name }),
).
IncludeForEach(govy.New[Container](
IncludeForEach(govy.New(
govy.For(func(c Container) string { return c.Name }).
WithName("name").
Required().
Expand All @@ -114,7 +114,7 @@ func TestPlan(t *testing.T) {
)),
)

validator := govy.New[Pod](
validator := govy.New(
govy.For(func(p Pod) string { return p.APIVersion }).
WithName("apiVersion").
Required().
Expand Down
12 changes: 6 additions & 6 deletions pkg/govy/test_data/expected_pod_plan.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{
"path": "$.metadata.annotations",
"type": "Annotations",
"package": "github.com/nobl9/nobl9-go/internal/validation",
"package": "github.com/nobl9/govy/pkg/govy_test",
"rules": [
{
"description": "length must be less than or equal to 10",
Expand All @@ -33,7 +33,7 @@
{
"path": "$.metadata.annotations.*",
"type": "MapItem[string,string]",
"package": "github.com/nobl9/nobl9-go/internal/validation",
"package": "github.com/nobl9/govy/pkg/govy",
"rules": [
{
"description": "key and value must not be equal"
Expand All @@ -43,7 +43,7 @@
{
"path": "$.metadata.labels",
"type": "Labels",
"package": "github.com/nobl9/nobl9-go/internal/validation",
"package": "github.com/nobl9/govy/pkg/govy_test",
"rules": [
{
"description": "length must be less than or equal to 10",
Expand Down Expand Up @@ -99,7 +99,7 @@
{
"path": "$.spec.containers",
"type": "[]Container",
"package": "github.com/nobl9/nobl9-go/internal/validation",
"package": "github.com/nobl9/govy/pkg/govy_test",
"rules": [
{
"description": "length must be less than or equal to 10",
Expand All @@ -114,12 +114,12 @@
{
"path": "$.spec.containers[*].env",
"type": "[]EnvVar",
"package": "github.com/nobl9/nobl9-go/internal/validation"
"package": "github.com/nobl9/govy/pkg/govy_test"
},
{
"path": "$.spec.containers[*].env[*]",
"type": "EnvVar",
"package": "github.com/nobl9/nobl9-go/internal/validation",
"package": "github.com/nobl9/govy/pkg/govy_test",
"rules": [
{
"description": "custom error!"
Expand Down

0 comments on commit 1256b1a

Please sign in to comment.