Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Update map values test, migrate to go mod. (#12)
Browse files Browse the repository at this point in the history
* Update map values test

* Update go mod deps

* Lock travis to 1.11.4, remove verbose logs

* Add go mod install step

* Bring back coveralls/gover deps
  • Loading branch information
cam-stitt authored Jan 22, 2019
1 parent 031b19c commit 3ab177a
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 86 deletions.
13 changes: 2 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
language: go
dist: trusty
go:
- 1.9.x
- 1.10.x
- 1.11.x
os:
- linux
env:
- DEP_VERSION="0.5.0"
go_import_path: github.com/openpixel/rise
before_install:
# Download the binary to bin folder in $GOPATH
- curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep
# Make the binary executable
- chmod +x $GOPATH/bin/dep
- go get github.com/mattn/goveralls
- go get github.com/modocache/gover

install:
- dep ensure
- go mod download
script:
- go test -race -v ./...
- go test -race ./...
- ./coveralls.sh
51 changes: 0 additions & 51 deletions Gopkg.lock

This file was deleted.

22 changes: 0 additions & 22 deletions Gopkg.toml

This file was deleted.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ $ rise -i ./examples/input.json -o ./examples/output.json --config ./examples/va
- More configuration CLI arguments
- Support for directories as inputs/outputs
- Support for globs (eg: /tmp/*.json)
- Support for var overrides at cli level (eg: --var "foo=bar")

## Inspiration

Expand Down
12 changes: 12 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module github.com/openpixel/rise

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/hashicorp/hcl v0.0.0-20171017181929-23c074d0eceb
github.com/hashicorp/hil v0.0.0-20170627220502-fa9f258a9250
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/mitchellh/mapstructure v0.0.0-20171017171808-06020f85339e // indirect
github.com/mitchellh/reflectwalk v0.0.0-20170726202117-63d60e9d0dbc // indirect
github.com/spf13/cobra v0.0.1
github.com/spf13/pflag v1.0.0 // indirect
)
16 changes: 16 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/hashicorp/hcl v0.0.0-20171017181929-23c074d0eceb h1:1OvvPvZkn/yCQ3xBcM8y4020wdkMXPHLB4+NfoGWh4U=
github.com/hashicorp/hcl v0.0.0-20171017181929-23c074d0eceb/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w=
github.com/hashicorp/hil v0.0.0-20170627220502-fa9f258a9250 h1:fooK5IvDL/KIsi4LxF/JH68nVdrBSiGNPhS2JAQjtjo=
github.com/hashicorp/hil v0.0.0-20170627220502-fa9f258a9250/go.mod h1:KHvg/R2/dPtaePb16oW4qIyzkMxXOL38xjRN64adsts=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/mitchellh/mapstructure v0.0.0-20171017171808-06020f85339e h1:PtGHLB3CX3TFPcksODQMxncoeQKWwCgTg0bJ40VLJP4=
github.com/mitchellh/mapstructure v0.0.0-20171017171808-06020f85339e/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/reflectwalk v0.0.0-20170726202117-63d60e9d0dbc h1:gqYjvctjtX4GHzgfutJxZpvZ7XhGwQLGR5BASwhpO2o=
github.com/mitchellh/reflectwalk v0.0.0-20170726202117-63d60e9d0dbc/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/spf13/cobra v0.0.1 h1:zZh3X5aZbdnoj+4XkaBxKfhO4ot82icYdhhREIAXIj8=
github.com/spf13/cobra v0.0.1/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/pflag v1.0.0 h1:oaPbdDe/x0UncahuwiPxW1GYJyilRAdsPnq3e1yaPcI=
github.com/spf13/pflag v1.0.0/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
3 changes: 3 additions & 0 deletions internal/interpolation/funcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ func testInterpolationFunc(funcMap keyFuncs) func(t *testing.T, testCase functio
if actual.Value.(string) != testCase.expectation.(string) {
t.Fatalf("wrong result\ngiven %s\ngot: %#v\nwant: %#v", testCase.text, actual.Value, testCase.expectation)
}
} else if _, ok := testCase.expectation.(func(*testing.T, interface{})); ok {
fn := testCase.expectation.(func(*testing.T, interface{}))
fn(t, actual.Value)
} else {
if !reflect.DeepEqual(actual.Value, testCase.expectation) {
t.Fatalf("wrong result\ngiven %s\ngot: %#v\nwant: %#v", testCase.text, actual.Value, testCase.expectation)
Expand Down
25 changes: 24 additions & 1 deletion internal/interpolation/maps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,30 @@ func TestInterpolationFuncValues(t *testing.T) {
{
description: "Returns the values",
text: `${values(foo)}`,
expectation: []interface{}{"other2", "other"},
expectation: func(t *testing.T, val interface{}) {
result := val.([]interface{})
exp := []interface{}{"other2", "other"}

if len(result) != len(exp) {
t.Fatalf("slice length mismatched")
}

rMap := make(map[interface{}]int)
eMap := make(map[interface{}]int)

for _, elem := range result {
rMap[elem]++
}
for _, elem := range exp {
eMap[elem]++
}

for rMapKey, rMapVal := range rMap {
if eMap[rMapKey] != rMapVal {
t.Fatalf("mismatched slice values: %v, %v", result, exp)
}
}
},
vars: map[string]ast.Variable{
"foo": ast.Variable{
Type: ast.TypeMap,
Expand Down

0 comments on commit 3ab177a

Please # to comment.