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