woodpecker/pipeline/backend/kubernetes/service_test.go
Anbraten 3b0263442a
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>
2022-09-05 06:01:14 +02:00

47 lines
756 B
Go

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))
}