mirror of
https://github.com/foomo/squadron.git
synced 2025-10-16 12:35:42 +00:00
48 lines
882 B
Go
48 lines
882 B
Go
package configurd
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestLoadService(t *testing.T) {
|
|
file, err := os.Open("example/configurd/services/hello-service.yml")
|
|
assert.NoError(t, err)
|
|
defer file.Close()
|
|
|
|
expected := Service{
|
|
Name: "hello-service",
|
|
Docker: Docker{
|
|
File: "Dockerfile",
|
|
Context: "application",
|
|
Options: "",
|
|
Image: "foomo/configurd-hello",
|
|
},
|
|
Chart: "example",
|
|
}
|
|
|
|
actual, err := LoadService(file)
|
|
assert.NoError(t, err)
|
|
assert.Equal(t, expected, actual)
|
|
}
|
|
|
|
func TestService_Build(t *testing.T) {
|
|
svc := Service{
|
|
Name: "hello-service",
|
|
Docker: Docker{
|
|
File: "Dockerfile",
|
|
Context: "example/application/",
|
|
Options: "",
|
|
Image: "configurd-hello",
|
|
},
|
|
Chart: "example",
|
|
}
|
|
|
|
output, err := svc.Build(context.Background(), "latest")
|
|
assert.NoError(t, err)
|
|
t.Log(output)
|
|
}
|