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:
47
pipeline/backend/kubernetes/service_test.go
Normal file
47
pipeline/backend/kubernetes/service_test.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package kubernetes
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestService(t *testing.T) {
|
||||
expected := `
|
||||
{
|
||||
"metadata": {
|
||||
"name": "bar",
|
||||
"namespace": "foo",
|
||||
"creationTimestamp": null
|
||||
},
|
||||
"spec": {
|
||||
"ports": [
|
||||
{
|
||||
"port": 1,
|
||||
"targetPort": 1
|
||||
},
|
||||
{
|
||||
"port": 2,
|
||||
"targetPort": 2
|
||||
},
|
||||
{
|
||||
"port": 3,
|
||||
"targetPort": 3
|
||||
}
|
||||
],
|
||||
"selector": {
|
||||
"step": "baz"
|
||||
},
|
||||
"type": "ClusterIP"
|
||||
},
|
||||
"status": {
|
||||
"loadBalancer": {}
|
||||
}
|
||||
}`
|
||||
|
||||
s, _ := Service("foo", "bar", "baz", []string{"1", "2", "3"})
|
||||
j, err := json.Marshal(s)
|
||||
assert.Nil(t, err)
|
||||
assert.JSONEq(t, expected, string(j))
|
||||
}
|
Reference in New Issue
Block a user