mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-12 08:23:58 +02:00
8dc3fb964e
* Pass source of service to Deployment API; render templates properly * Enable Go modules by default. Honor runtime.Service.Exec * Make sure you remove go.mod and go.sum
27 lines
610 B
Go
27 lines
610 B
Go
package client
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
)
|
|
|
|
func TestTemplates(t *testing.T) {
|
|
name := "foo"
|
|
version := "123"
|
|
source := "github.com/foo/bar"
|
|
|
|
// Render default service
|
|
s := DefaultService(name, version)
|
|
bs := new(bytes.Buffer)
|
|
if err := renderTemplate(templates["service"], bs, s); err != nil {
|
|
t.Errorf("Failed to render kubernetes service: %v", err)
|
|
}
|
|
|
|
// Render default deployment
|
|
d := DefaultDeployment(name, version, source)
|
|
bd := new(bytes.Buffer)
|
|
if err := renderTemplate(templates["deployment"], bd, d); err != nil {
|
|
t.Errorf("Failed to render kubernetes deployment: %v", err)
|
|
}
|
|
}
|