|
|
|
|
@ -28,6 +28,13 @@ func testConfig() *RunConfig {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func testConfigFilter() *RunConfig {
|
|
|
|
|
config := testConfig()
|
|
|
|
|
config.SourceAmi = ""
|
|
|
|
|
config.SourceAmiFilter = AmiFilterOptions{}
|
|
|
|
|
return config
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRunConfigPrepare(t *testing.T) {
|
|
|
|
|
c := testConfig()
|
|
|
|
|
err := c.Prepare(nil)
|
|
|
|
|
@ -52,6 +59,25 @@ func TestRunConfigPrepare_SourceAmi(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRunConfigPrepare_SourceAmiFilterBlank(t *testing.T) {
|
|
|
|
|
c := testConfigFilter()
|
|
|
|
|
if err := c.Prepare(nil); len(err) != 1 {
|
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRunConfigPrepare_SourceAmiFilterGood(t *testing.T) {
|
|
|
|
|
c := testConfigFilter()
|
|
|
|
|
owner := "123"
|
|
|
|
|
filter_key := "name"
|
|
|
|
|
filter_value := "foo"
|
|
|
|
|
goodFilter := AmiFilterOptions{Owners: []*string{&owner}, Filters: map[*string]*string{&filter_key: &filter_value}}
|
|
|
|
|
c.SourceAmiFilter = goodFilter
|
|
|
|
|
if err := c.Prepare(nil); len(err) != 0 {
|
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRunConfigPrepare_SpotAuto(t *testing.T) {
|
|
|
|
|
c := testConfig()
|
|
|
|
|
c.SpotPrice = "auto"
|
|
|
|
|
|