Exemple #1
0
func TestComponentMarshalYAMLCluster(t *testing.T) {
	s := `name: test
tags: []
conflicts: []
cluster: true
cluster_host_count:
  min: 0
  threshold_healthy: 0
containers: []
`

	c := Component{
		Name:    "test",
		Cluster: true,
	}

	b, err := yaml.Marshal(c)
	if err != nil {
		t.Fatal(err)
	}

	if string(b) != s {
		t.Errorf("unexpected marshalled YAML,\nexpecting\n%s\ngot\n%s", s, string(b))
	}
}
func TestComponentMarshalYAML(t *testing.T) {
	s := `name: test
tags: []
conflicts: []
cluster: false
cluster_host_count:
  min: 0
  threshold_healthy: 0
host_requirements:
  cpu_cores: 0
  cpu_mhz: 0
  memory: ""
  disk_space: ""
host_volumes: []
containers: []
`

	c := Component{
		Name:    "test",
		Cluster: false,
	}

	b, err := yaml.Marshal(c)
	if err != nil {
		t.Fatal(err)
	}

	if string(b) != s {
		t.Errorf("unexpected marshalled YAML,\nexpecting\n%s\ngot\n%s", s, string(b))
	}
}
func TestContainerMarshalYAMLCluster(t *testing.T) {
	s := `source: public
image_name: test
display_name: ""
version: ""
privileged: false
network_mode: ""
cpu_shares: ""
memory_limit: ""
memory_swap_limit: ""
allocate_tty: ""
security_cap_add: []
security_options: []
hostname: ""
cmd: ""
ephemeral: false
suppress_restart: []
cluster: true
restart: null
cluster_instance_count:
  initial: 1
  threshold_healthy: 0
publish_events: []
config_files: []
customer_files: []
env_vars: []
ports: []
volumes: []
extra_hosts: []
support_files: []
support_commands: []
when: ""
`

	c := Container{
		Source:    "public",
		ImageName: "test",
		Cluster:   true,
	}

	b, err := yaml.Marshal(c)
	if err != nil {
		t.Fatal(err)
	}

	if string(b) != s {
		t.Errorf("unexpected marshalled YAML,\nexpecting\n%s\ngot\n%s", s, string(b))
	}
}
Exemple #4
0
func TestContainerMarshalYAMLCluster(t *testing.T) {
	s := `source: public
image_name: test
display_name: ""
version: ""
privileged: false
hostname: ""
cmd: ""
ephemeral: ""
cluster: true
restart: null
cluster_instance_count:
  initial: 1
  threshold_healthy: 0
publish_events: []
config_files: []
customer_files: []
env_vars: []
ports: []
volumes: []
support_files: []
support_commands: []
when: ""
`

	c := Container{
		Source:    "public",
		ImageName: "test",
		Cluster:   true,
	}

	b, err := yaml.Marshal(c)
	if err != nil {
		t.Fatal(err)
	}

	if string(b) != s {
		t.Errorf("unexpected marshalled YAML,\nexpecting\n%s\ngot\n%s", s, string(b))
	}
}
Exemple #5
0
func TestComponentMarshalYAML(t *testing.T) {
	s := `name: test
tags: []
conflicts: []
cluster: false
containers: []
`

	c := Component{
		Name:    "test",
		Cluster: false,
	}

	b, err := yaml.Marshal(c)
	if err != nil {
		t.Fatal(err)
	}

	if string(b) != s {
		t.Errorf("unexpected marshalled YAML,\nexpecting\n%s\ngot\n%s", s, string(b))
	}
}