https://github.com/roma-glushko/testcrd
Unit test your Kubernetes Custom Resource Definitions (CRDs) 🛠️
https://github.com/roma-glushko/testcrd
crd kubernetes kubernetes-manifests kubernetes-operator
Last synced: about 1 month ago
JSON representation
Unit test your Kubernetes Custom Resource Definitions (CRDs) 🛠️
- Host: GitHub
- URL: https://github.com/roma-glushko/testcrd
- Owner: roma-glushko
- License: mit
- Created: 2023-11-04T19:48:17.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-14T21:42:50.000Z (almost 2 years ago)
- Last Synced: 2025-04-06T05:42:36.938Z (6 months ago)
- Topics: crd, kubernetes, kubernetes-manifests, kubernetes-operator
- Language: Go
- Homepage: https://pkg.go.dev/github.com/roma-glushko/testcrd
- Size: 29.3 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# testcrd
Unit test your Kubernetes Custom Resource Definitions (CRDs) against concreate resource samples
without a need for a running Kubernetes cluster.The primary use case would be to ensure backward-compatibility of CRD changes.
## Installation
```bash
go get github.com/roma-glushko/testcrd
```## Usage
```go
import (
"github.com/roma-glushko/testcrd"
"testing"
)func TestCRD_AssertDefinitionBackwardCompatible(t *testing.T) {
asserter := testcrd.NewResourceAsserter()_ = asserter.LoadFromFiles([]string{
"crd/my_crd.yaml",
})_ = asserter.AssertFiles(t, []string{
"fixtures/my_crd/resource.sample.yaml",
})
}
```