mirror of
https://codeberg.org/crowci/crow.git
synced 2025-08-09 07:42:52 +03:00
Adding initial version of Kubernetes backend (#552)
Co-authored-by: laszlocph <laszlo@laszlo.cloud> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Rynoxx <rynoxx@grid-servers.net>
This commit is contained in:
62
pipeline/backend/kubernetes/volume_test.go
Normal file
62
pipeline/backend/kubernetes/volume_test.go
Normal file
@@ -0,0 +1,62 @@
|
||||
package kubernetes
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestPersistentVolumeClaim(t *testing.T) {
|
||||
expectedRwx := `
|
||||
{
|
||||
"metadata": {
|
||||
"name": "someName",
|
||||
"namespace": "someNamespace",
|
||||
"creationTimestamp": null
|
||||
},
|
||||
"spec": {
|
||||
"accessModes": [
|
||||
"ReadWriteMany"
|
||||
],
|
||||
"resources": {
|
||||
"requests": {
|
||||
"storage": "1Gi"
|
||||
}
|
||||
},
|
||||
"storageClassName": "local-storage"
|
||||
},
|
||||
"status": {}
|
||||
}`
|
||||
|
||||
expectedRwo := `
|
||||
{
|
||||
"metadata": {
|
||||
"name": "someName",
|
||||
"namespace": "someNamespace",
|
||||
"creationTimestamp": null
|
||||
},
|
||||
"spec": {
|
||||
"accessModes": [
|
||||
"ReadWriteOnce"
|
||||
],
|
||||
"resources": {
|
||||
"requests": {
|
||||
"storage": "1Gi"
|
||||
}
|
||||
},
|
||||
"storageClassName": "local-storage"
|
||||
},
|
||||
"status": {}
|
||||
}`
|
||||
|
||||
pvc := PersistentVolumeClaim("someNamespace", "someName", "local-storage", "1Gi", true)
|
||||
j, err := json.Marshal(pvc)
|
||||
assert.Nil(t, err)
|
||||
assert.JSONEq(t, expectedRwx, string(j))
|
||||
|
||||
pvc = PersistentVolumeClaim("someNamespace", "someName", "local-storage", "1Gi", false)
|
||||
j, err = json.Marshal(pvc)
|
||||
assert.Nil(t, err)
|
||||
assert.JSONEq(t, expectedRwo, string(j))
|
||||
}
|
Reference in New Issue
Block a user