func TestConvertToTaskDefinitionWithEnv(t *testing.T) {
	envKey := "username"
	envValue := "root"
	env := envKey + "=" + envValue
	serviceConfig := &libcompose.ServiceConfig{
		Environment: libcompose.NewMaporEqualSlice([]string{env}),
	}

	taskDefinition := convertToTaskDefinitionInTest(t, "name", serviceConfig)
	containerDef := *taskDefinition.ContainerDefinitions[0]

	if envKey != aws.StringValue(containerDef.Environment[0].Name) ||
		envValue != aws.StringValue(containerDef.Environment[0].Value) {
		t.Errorf("Expected env [%s] But was [%v]", env, containerDef.Environment)
	}
}
func TestConvertToTaskDefinition(t *testing.T) {
	name := "mysql"
	memory := int64(100) // 1 MiB = 1048576B
	envKey := "username"
	envValue := "root"
	env := envKey + "=" + envValue
	cpu := int64(10)
	image := "testimage"
	projectName := "ProjectName"
	volumes := []string{hostPath + ":" + containerPath}
	volumesFrom := []string{"container1"}
	links := []string{"container1"}
	command := "cmd"

	serviceConfigs := make(map[string]*libcompose.ServiceConfig)
	serviceConfigs[name] = &libcompose.ServiceConfig{
		MemLimit:    int64(1048576) * memory,
		Environment: libcompose.NewMaporEqualSlice([]string{env}),
		CpuShares:   cpu,
		Image:       image,
		Command:     libcompose.NewCommand(command),
		Volumes:     volumes,
		VolumesFrom: volumesFrom,
		Links:       libcompose.NewMaporColonSlice(links),
	}

	context := libcompose.Context{
		ProjectName: projectName,
	}
	taskDefinition, err := ConvertToTaskDefinition(context, serviceConfigs)
	if err != nil {
		t.Errorf("Expected to convert [%v] serviceConfigs without errors. But got [%v]", serviceConfigs, err)
	}
	containerDef := *taskDefinition.ContainerDefinitions[0]
	if name != *containerDef.Name {
		t.Errorf("Expected Name [%s] But was [%s]", name, *containerDef.Name)
	}
	if memory != *containerDef.Memory {
		t.Errorf("Expected memory [%s] But was [%s]", memory, *containerDef.Memory)
	}
	if cpu != *containerDef.Cpu {
		t.Errorf("Expected cpu [%s] But was [%s]", cpu, *containerDef.Name)
	}
	if image != *containerDef.Image {
		t.Errorf("Expected Image [%s] But was [%s]", image, *containerDef.Image)
	}
	if len(containerDef.Command) != 1 || command != *containerDef.Command[0] {
		t.Errorf("Expected command [%s] But was [%v]", command, containerDef.Command)
	}
	if len(volumesFrom) != len(containerDef.VolumesFrom) || volumesFrom[0] != *containerDef.VolumesFrom[0].SourceContainer {
		t.Errorf("Expected volumesFrom [%v] But was [%v]", volumesFrom, containerDef.VolumesFrom)
	}
	if len(links) != len(containerDef.Links) || links[0] != *containerDef.Links[0] {
		t.Errorf("Expected links [%v] But was [%v]", links, containerDef.Links)
	}

	volumeDef := *taskDefinition.Volumes[0]
	mountPoint := *containerDef.MountPoints[0]
	if hostPath != *volumeDef.Host.SourcePath {
		t.Errorf("Expected HostSourcePath [%s] But was [%s]", hostPath, *volumeDef.Host.SourcePath)
	}
	if containerPath != *mountPoint.ContainerPath {
		t.Errorf("Expected containerPath [%s] But was [%s]", containerPath, *mountPoint.ContainerPath)
	}
	if *volumeDef.Name != *mountPoint.SourceVolume {
		t.Errorf("Expected volume name to match. "+
			"Got Volume.Name=[%s] And MountPoint.SourceVolume=[%s]", *volumeDef.Name, *mountPoint.SourceVolume)
	}
}