Skip to content

Commit

Permalink
fix: Update dependencies and fix unit tests (#776)
Browse files Browse the repository at this point in the history
* fix: Update dependencies and fix unit tests

* Updated dependencies

* Update apply.go

* Update apply_test.go

* Made test versions consistent

* Update outputs.tf

* Update outputs.tf
  • Loading branch information
alexlokshin-czi authored Jan 18, 2023
1 parent 4bbf893 commit 3a7445b
Show file tree
Hide file tree
Showing 6 changed files with 291 additions and 572 deletions.
10 changes: 5 additions & 5 deletions apply/apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ func TestApplyModuleInvocation(t *testing.T) {
r.Nil(e)
i, e = afero.ReadFile(fs, "mymodule/outputs.tf")
r.Nil(e)
expected = "# Auto-generated by fogg. Do not edit\n# Make improvements in fogg, so that everyone can benefit.\n\noutput \"bar\" {\n value = module.test-module.bar\n}\n\noutput \"foo\" {\n value = module.test-module.foo\n}\n\n\n"
expected = "# Auto-generated by fogg. Do not edit\n# Make improvements in fogg, so that everyone can benefit.\n\noutput \"bar\" {\n value = module.test-module.bar\n sensitive = false\n}\n\noutput \"foo\" {\n value = module.test-module.foo\n sensitive = false\n}\n\n\n"
r.Equal(expected, string(i))
}

Expand Down Expand Up @@ -502,7 +502,7 @@ func TestTFEConfig(t *testing.T) {
},
}
emptyTrigger := []string{}
tfVersion := "0.13.5"
tfVersion := "0.100.0"
existingLocals := LocalsTFE{
Locals: &Locals{
Envs: map[string]map[string]*TFEWorkspace{
Expand Down Expand Up @@ -569,7 +569,7 @@ func TestApplyModuleInvocationWithEmptyVariables(t *testing.T) {
r.Nil(e)
i, e = afero.ReadFile(fs, "mymodule/outputs.tf")
r.Nil(e)
expected = "# Auto-generated by fogg. Do not edit\n# Make improvements in fogg, so that everyone can benefit.\n\noutput \"bar\" {\n value = module.test-module.bar\n}\n\noutput \"foo\" {\n value = module.test-module.foo\n}\n\n\n"
expected = "# Auto-generated by fogg. Do not edit\n# Make improvements in fogg, so that everyone can benefit.\n\noutput \"bar\" {\n value = module.test-module.bar\n sensitive = false\n}\n\noutput \"foo\" {\n value = module.test-module.foo\n sensitive = false\n}\n\n\n"
r.Equal(expected, string(i))
}

Expand Down Expand Up @@ -602,7 +602,7 @@ func TestApplyModuleInvocationWithOneDefaultVariable(t *testing.T) {
r.Nil(e)
i, e = afero.ReadFile(fs, "mymodule/outputs.tf")
r.Nil(e)
expected = "# Auto-generated by fogg. Do not edit\n# Make improvements in fogg, so that everyone can benefit.\n\noutput \"bar\" {\n value = module.test-module.bar\n}\n\noutput \"foo\" {\n value = module.test-module.foo\n}\n\n\n"
expected = "# Auto-generated by fogg. Do not edit\n# Make improvements in fogg, so that everyone can benefit.\n\noutput \"bar\" {\n value = module.test-module.bar\n sensitive = false\n}\n\noutput \"foo\" {\n value = module.test-module.foo\n sensitive = false\n}\n\n\n"
r.Equal(expected, string(i))
}

Expand Down Expand Up @@ -637,7 +637,7 @@ func TestApplyModuleInvocationWithModuleName(t *testing.T) {
r.Nil(e)
i, e = afero.ReadFile(fs, "mymodule/outputs.tf")
r.Nil(e)
expected = "# Auto-generated by fogg. Do not edit\n# Make improvements in fogg, so that everyone can benefit.\n\noutput \"bar\" {\n value = module.module-name.bar\n}\n\noutput \"foo\" {\n value = module.module-name.foo\n}\n\n\n"
expected = "# Auto-generated by fogg. Do not edit\n# Make improvements in fogg, so that everyone can benefit.\n\noutput \"bar\" {\n value = module.module-name.bar\n sensitive = false\n}\n\noutput \"foo\" {\n value = module.module-name.foo\n sensitive = false\n}\n\n\n"
r.Equal(expected, string(i))
}

Expand Down
11 changes: 7 additions & 4 deletions apply/golden_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ func TestIntegration(t *testing.T) {
r.NoError(e2)
r.NotNil(i2)

logrus.Debugf("i1 size: %d ii2 size %d", i1.Size(), i2.Size())
r.Equalf(i1.Size(), i2.Size(), "file size: %s", path)
// This (below) doesn't currently work for files created on a mac then tested on linux. :shrug:
// r.Equalf(i1.Mode(), i2.Mode(), "file mode: %s, %o vs %o", path, i1.Mode(), i2.Mode())

Expand All @@ -118,8 +116,13 @@ func TestIntegration(t *testing.T) {
f2, e4 := afero.ReadFile(fs, path)
r.NoError(e4)

logrus.Debugf("f1:\n%s\n\n---- ", f1)
logrus.Debugf("f2:\n%s\n\n---- ", f2)
if i1.Size() != i2.Size() {
logrus.Debugf("f1:\n%s\n\n---- ", f1)
logrus.Debugf("f2:\n%s\n\n---- ", f2)
}

logrus.Debugf("i1 size: %d ii2 size %d", i1.Size(), i2.Size())
r.Equalf(i1.Size(), i2.Size(), "file size: %s", path)

r.Equal(f1, f2, path)
}
Expand Down
142 changes: 75 additions & 67 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,119 +1,127 @@
module github.com/chanzuckerberg/fogg

go 1.18
go 1.19

replace github.com/spf13/afero v1.2.2 => github.com/chanzuckerberg/afero v0.0.0-20190514223411-36a9495a9b51
replace github.com/spf13/afero => github.com/chanzuckerberg/afero v0.0.0-20190514223411-36a9495a9b51

replace github.com/hashicorp/terraform => github.com/hashicorp/terraform v0.14.9

require (
github.com/Masterminds/sprig v2.22.0+incompatible
github.com/antzucaro/matchr v0.0.0-20191224151129-ab6ba461ddec
github.com/aws/aws-sdk-go v1.44.126
github.com/antzucaro/matchr v0.0.0-20221106193745-7bed6ef61ef9
github.com/aws/aws-sdk-go v1.44.180
github.com/blang/semver v3.5.1+incompatible
github.com/chanzuckerberg/go-misc v0.0.0-20210209191033-ae96c0409e3f
github.com/chanzuckerberg/go-misc v1.0.1
github.com/davecgh/go-spew v1.1.1
github.com/fatih/color v1.10.0
github.com/go-errors/errors v1.1.1
github.com/go-git/go-git/v5 v5.4.2
github.com/fatih/color v1.13.0
github.com/go-errors/errors v1.4.2
github.com/go-git/go-git/v5 v5.5.2
github.com/google/go-github/v27 v27.0.6
github.com/hashicorp/go-getter v1.6.2
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/hcl/v2 v2.14.1
github.com/hashicorp/hcl/v2 v2.15.0
github.com/hashicorp/hcl2 v0.0.0-20191002203319-fb75b3253c80
github.com/hashicorp/terraform v0.14.9
github.com/hashicorp/terraform-config-inspect v0.0.0-20211115214459-90acf1ca460f
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a
github.com/hashicorp/terraform v1.3.7
github.com/hashicorp/terraform-config-inspect v0.0.0-20221020162138-81db043ad408
github.com/jinzhu/copier v0.3.5
github.com/kelseyhightower/envconfig v1.4.0
github.com/kr/pretty v0.3.1
github.com/mitchellh/go-homedir v1.1.0
github.com/peterbourgon/diskv v2.0.1+incompatible
github.com/pkg/errors v0.9.1
github.com/segmentio/go-prompt v1.2.1-0.20161017233205-f0d19b6901ad
github.com/sirupsen/logrus v1.9.0
github.com/spf13/afero v1.2.2
github.com/spf13/afero v1.9.3
github.com/spf13/cobra v1.6.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.1
golang.org/x/exp v0.0.0-20220916125017-b168a2c6b86b
golang.org/x/exp v0.0.0-20230116083435-1de6713980de
gopkg.in/go-playground/validator.v9 v9.31.0
gopkg.in/ini.v1 v1.67.0
gopkg.in/yaml.v3 v3.0.1
)

require (
cloud.google.com/go v0.65.0 // indirect
cloud.google.com/go/storage v1.10.0 // indirect
github.com/Masterminds/goutils v1.1.0 // indirect
cloud.google.com/go v0.108.0 // indirect
cloud.google.com/go/compute v1.15.1 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v0.10.0 // indirect
cloud.google.com/go/storage v1.28.1 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Microsoft/go-winio v0.4.16 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230113180642-068501e20d67 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-cidr v1.1.0 // indirect
github.com/apparentlymart/go-textseg v1.0.0 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/apparentlymart/go-versions v1.0.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/bmatcuk/doublestar v1.2.4 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/bmatcuk/doublestar v1.3.4 // indirect
github.com/cloudflare/circl v1.3.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/go-playground/locales v0.13.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.4.2 // indirect
github.com/google/btree v1.0.0 // indirect
github.com/go-git/go-billy/v5 v5.4.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/google/uuid v1.1.1 // indirect
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.1 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.6.6 // indirect
github.com/hashicorp/go-retryablehttp v0.7.2 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
github.com/howeyc/gopass v0.0.0-20190910152052-7cb4b85ec19c // indirect
github.com/huandu/xstrings v1.3.1 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/howeyc/gopass v0.0.0-20210920133722-c8aef6fb66ef // indirect
github.com/huandu/xstrings v1.4.0 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jstemmer/go-junit-report v0.9.1 // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/klauspost/compress v1.11.2 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.15.14 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.0 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/reflectwalk v1.0.1 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/pjbgf/sha1cd v0.2.3 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/ulikunitz/xz v0.5.8 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/skeema/knownhosts v1.1.0 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
github.com/vmihailenco/tagparser v0.1.1 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
github.com/zclconf/go-cty v1.11.0 // indirect
github.com/zclconf/go-cty-yaml v1.0.2 // indirect
go.opencensus.io v0.22.4 // indirect
golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 // indirect
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 // indirect
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.12 // indirect
google.golang.org/api v0.34.0 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d // indirect
google.golang.org/grpc v1.31.1 // indirect
google.golang.org/protobuf v1.25.0 // indirect
github.com/vmihailenco/tagparser v0.1.2 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/zclconf/go-cty v1.12.1 // indirect
github.com/zclconf/go-cty-yaml v1.0.3 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.5.0 // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/net v0.5.0 // indirect
golang.org/x/oauth2 v0.4.0 // indirect
golang.org/x/sys v0.4.0 // indirect
golang.org/x/term v0.4.0 // indirect
golang.org/x/text v0.6.0 // indirect
golang.org/x/tools v0.5.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.107.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230113154510-dbe35b8444a5 // indirect
google.golang.org/grpc v1.52.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
)
Loading

0 comments on commit 3a7445b

Please sign in to comment.