2019-11-15 13:41:40 +00:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestTemplates(t *testing.T) {
|
|
|
|
name := "foo"
|
2019-11-21 17:31:13 +00:00
|
|
|
version := "123"
|
|
|
|
source := "github.com/foo/bar"
|
2019-11-15 13:41:40 +00:00
|
|
|
|
|
|
|
// Render default service
|
|
|
|
s := DefaultService(name, version)
|
|
|
|
bs := new(bytes.Buffer)
|
2019-11-21 17:31:13 +00:00
|
|
|
if err := renderTemplate(templates["service"], bs, s); err != nil {
|
2019-11-15 13:41:40 +00:00
|
|
|
t.Errorf("Failed to render kubernetes service: %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Render default deployment
|
2019-11-21 17:31:13 +00:00
|
|
|
d := DefaultDeployment(name, version, source)
|
2019-11-15 13:41:40 +00:00
|
|
|
bd := new(bytes.Buffer)
|
2019-11-21 17:31:13 +00:00
|
|
|
if err := renderTemplate(templates["deployment"], bd, d); err != nil {
|
2019-11-15 13:41:40 +00:00
|
|
|
t.Errorf("Failed to render kubernetes deployment: %v", err)
|
|
|
|
}
|
|
|
|
}
|