mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-25 09:50:31 +00:00
3b0263442a
Co-authored-by: laszlocph <laszlo@laszlo.cloud> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Rynoxx <rynoxx@grid-servers.net>
47 lines
756 B
Go
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))
|
|
}
|