Skip to content

Commit

Permalink
Validation test for issue #86 (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinbunney authored May 24, 2021
1 parent 47ddb4b commit 995e905
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions kubernetes/resource_kubectl_manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -822,3 +822,39 @@ func TestGenerateSelfLink(t *testing.T) {
link = generateSelfLink("apps/v1", "ns", "Deployment", "name")
assert.Equal(t, link, "/apis/apps/v1/namespaces/ns/deployments/name")
}

func TestAccKubectlServerSideValidationFailure(t *testing.T) {

config := `
resource "kubectl_manifest" "test" {
yaml_body = <<YAML
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress
spec:
rules:
- host: "test-a.proxypile.tk"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nginx.test-a.svc.cluster.local
port:
number: 8080
YAML
}
`
expectedError, _ := regexp.Compile(".*Invalid value: \"nginx.test-a.svc.cluster.local\": a DNS-1035 label must consist of lower case alphanumeric characters.*")
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
Steps: []resource.TestStep{
{
ExpectError: expectedError,
Config: config,
},
},
})
}

0 comments on commit 995e905

Please sign in to comment.