Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalAsYaml ¶
func MarshalAsYaml(input interface{}) []byte
MarshalAsYaml is a test utility function that marshals Kubernetes objects to YAML format. It automatically fails the test if marshaling fails.
Usage example:
import (
"strings" libk8stest "github.com/bborbe/k8s/test" . "github.com/onsi/gomega" "github.com/onsi/gomega/gbytes"
)
It("has correct YAML content", func() {
// Marshal any Kubernetes object to YAML
bytes := libk8stest.MarshalAsYaml(service)
// Verify the YAML contains expected content
Expect(gbytes.BufferWithBytes(bytes)).To(gbytes.Say(strings.TrimSpace(`
apiVersion: v1 kind: Service metadata:
name: my-service namespace: default
spec:
ports: - port: 80 targetPort: 8080 selector: app: my-app
`))) })
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.