Skip to content

Commit

Permalink
updating to support -links
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcherubini committed Jul 3, 2017
1 parent a4f26fa commit 1be5672
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
6 changes: 5 additions & 1 deletion main_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package main

import "testing"
import (
"fmt"
"testing"
)

func TestLoadConfigToModel(t *testing.T) {
config, _, err := loadConfigToModel("test.yaml")
fmt.Println(config)
if err != nil {
t.Fail()
}
Expand Down
9 changes: 5 additions & 4 deletions models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ type Config struct {

//Containers ldfdf
type Containers struct {
Name string `json:"name"`
Image string `json:"image"`
Ports []Port `json:"ports"`
Env []Env `json:"env"`
Name string `json:"name"`
Image string `json:"image"`
Ports []Port `json:"ports"`
Links []string `json:"links"`
Env []Env `json:"env"`
}

//Control is the control file
Expand Down
4 changes: 2 additions & 2 deletions models/models_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (

func TestConfig(t *testing.T) {
config := models.Config{}
input := []byte(`{"containers":[{"env":[{"name":"ENV","value":"test"}],"image":"repo/test-yaml:1.0.0","name":"test-yaml","ports":[{"containerPort":9000,"hostPort":9000,"protocol":"tcp"}]}],"network":"host"}`)
input := []byte(`{"containers":[{"env":[{"name":"ENV","value":"test"}],"image":"repo/test-yaml:1.0.0","name":"test-yaml","links":["farts"],"ports":[{"containerPort":9000,"hostPort":9000,"protocol":"tcp"}]}],"network":"host"}`)
err := json.Unmarshal(input, &config)
if err != nil {
return
t.Errorf("Error Marsheling json ", err)
}
container := config.Containers[0]
testEnv := container.Env
Expand Down
2 changes: 2 additions & 0 deletions test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ containers:
env:
- name: 'ENV'
value: test
links:
- farts
network: host
control:
package: test-yaml
Expand Down

0 comments on commit 1be5672

Please sign in to comment.