Skip to content

Commit

Permalink
Merge 75bbcef into b83d703
Browse files Browse the repository at this point in the history
  • Loading branch information
istreeter committed Feb 24, 2020
2 parents b83d703 + 75bbcef commit aba1f4c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: go
go:
- 1.8
- 1.13

before_script:
- wget https://releases.hashicorp.com/consul/1.4.0/consul_1.4.0_linux_amd64.zip
Expand All @@ -19,7 +19,7 @@ deploy:
provider: script
script: make release
on:
condition: '"${TRAVIS_GO_VERSION}" == "1.8"'
condition: '"${TRAVIS_GO_VERSION}" == "1.13"'
tags: true

env:
Expand Down
6 changes: 3 additions & 3 deletions src/config_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func TestTemplateRawBytes_timeWithFormat(t *testing.T) {
assert.Nil(templatedByteArr)
assert.NotNil(err)
assert.Equal(`template: `+templateName+`:1:10: executing "`+templateName+
`" at <timeWithFormat "qwer...>: error calling timeWithFormat: strconv.ParseInt: parsing "qwerty": invalid syntax`, err.Error())
`" at <timeWithFormat "qwerty" "2006">: error calling timeWithFormat: strconv.ParseInt: parsing "qwerty": invalid syntax`, err.Error())
}

func TestTemplateRawBytes_systemEnv(t *testing.T) {
Expand All @@ -235,7 +235,7 @@ func TestTemplateRawBytes_systemEnv(t *testing.T) {
assert.Nil(templatedByteArr)
assert.Equal(
`template: `+templateName+`:1:10: executing "`+templateName+
`" at <systemEnv "DOESNT_EX...>: error calling systemEnv: environment variable DOESNT_EXIST not set`,
`" at <systemEnv "DOESNT_EXIST">: error calling systemEnv: environment variable DOESNT_EXIST not set`,
err.Error())
}

Expand Down Expand Up @@ -272,7 +272,7 @@ func TestTemplateRawBytes_base64File(t *testing.T) {
assert.Nil(templatedByteArr)
assert.Equal(
`template: `+templateName+`:1:10: executing "`+templateName+
`" at <base64File "/tmp/doe...>: error calling base64File: open /tmp/doesnt/exist: no such file or directory`,
`" at <base64File "/tmp/doesnt/exist">: error calling base64File: open /tmp/doesnt/exist: no such file or directory`,
err.Error())
}

Expand Down
17 changes: 4 additions & 13 deletions src/emr_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"errors"
"math/rand"
"strconv"
"strings"
"time"

log "github.com/Sirupsen/logrus"
Expand Down Expand Up @@ -368,7 +367,7 @@ func (ec EmrCluster) GetBootstrapActions() []*emr.BootstrapActionConfig {
}

emrBootstrapAction := emr.BootstrapActionConfig{
Name: aws.String(bootstrapAction.Name),
Name: aws.String(bootstrapAction.Name),
ScriptBootstrapAction: &emrScriptBootstrapAction,
}

Expand Down Expand Up @@ -411,22 +410,14 @@ func (ec EmrCluster) GetApplications() ([]*emr.Application, error) {
applications := ec.Config.Applications

var emrApplicationArr []*emr.Application
allowedApps := []string{"Hadoop", "Hive", "Mahout", "Pig", "Spark"}

if applications != nil && len(applications) > 0 {
emrApplicationArr = make([]*emr.Application, len(applications))

for i, application := range applications {
if StringInSlice(application, allowedApps) {
emrApplication := emr.Application{
Name: aws.String(application),
}

emrApplicationArr[i] = &emrApplication
} else {
return nil, errors.New("Only " + strings.Join(allowedApps, ", ") +
" are allowed applications")
emrApplication := emr.Application{
Name: aws.String(application),
}
emrApplicationArr[i] = &emrApplication
}
}

Expand Down
7 changes: 0 additions & 7 deletions src/emr_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,13 +469,6 @@ func TestGetApplications_WithApps(t *testing.T) {
assert.Len(apps, 2)
assert.Equal(aws.String("Hadoop"), apps[0].Name)
assert.Equal(aws.String("Spark"), apps[1].Name)

// fails is the app is not allowed
record.Applications = []string{"Snowplow"}
ec, _ = InitEmrCluster(*record)
_, err := ec.GetApplications()
assert.NotNil(err)
assert.Equal("Only Hadoop, Hive, Mahout, Pig, Spark are allowed applications", err.Error())
}

func TestGetLocation_Fail(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion src/lock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"testing"

"github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/testutil"
"github.com/hashicorp/consul/sdk/testutil"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func getConsulFlag() cli.StringFlag {
func up(emrConfig string, vars string) (string, error) {
clusterRecord, err := parseClusterRecord(emrConfig, vars)
if err != nil {
return "", nil
return "", err
}

return upWithConfig(clusterRecord)
Expand Down

0 comments on commit aba1f4c

Please sign in to comment.