Skip to content

Commit

Permalink
1. go mod tidy
Browse files Browse the repository at this point in the history
2. init behavior change
  • Loading branch information
patilpankaj212 committed Mar 17, 2021
1 parent df2f9c2 commit 70f3eb6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
6 changes: 0 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1104,8 +1104,6 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1 h1:Kvvh58BN8Y9/lBi7hTekvtMpm07eUZ0ck5pRHpsMWrY=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -1237,8 +1235,6 @@ golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210113181707-4bcb84eeeb78/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210218155724-8ebf48af031b h1:lAZ0/chPUDWwjqosYR0X4M490zQhMsiJ4K3DbA7o+3g=
golang.org/x/sys v0.0.0-20210218155724-8ebf48af031b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa h1:ZYxPR6aca/uhfRJyaOAtflSHjJYiktO7QnJC5ut7iY4=
golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down Expand Up @@ -1480,8 +1476,6 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.1.2 h1:SMdYLJl312RXuxXziCCHhRsp/tvct9cGKey0yv95tZM=
honnef.co/go/tools v0.1.2/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las=
honnef.co/go/tools v0.1.3 h1:qTakTkI6ni6LFD5sBwwsdSO+AQqbSIxOauHTTQKZ/7o=
honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las=
k8s.io/api v0.19.0 h1:XyrFIJqTYZJ2DU7FBE/bSPz7b1HvbVBuBf07oeo6eTc=
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/init/config/valid_config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[policy]
repo_url = "https://github.com/accurics/KaiMonkey.git"
branch = "master"
branch = "master"
path = "valid/path"
25 changes: 16 additions & 9 deletions test/e2e/init/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,11 @@ var _ = Describe("Init", func() {
JustAfterEach(func() {
os.Setenv(terrascanConfigEnvName, "")
})
It("should error out and exit with status code 1", func() {
session = initUtil.RunInitCommand(terrascanBinaryPath, outWriter, errWriter, helper.ExitCodeOne)
helper.ContainsErrorSubString(session, "invalid/path: no such file or directory")
// The current behavior of terrascan is that, in case of init command, even if the value of
// rego_subdir is an invalid/non-existant directory, the init is successful and repoURL will be
// cloned at the base path (either default or based on config file)
It("should not error out and exit with status code 0", func() {
initUtil.RunInitCommand(terrascanBinaryPath, outWriter, errWriter, helper.ExitCodeZero)
})
})
When("the config file has invalid path", func() {
Expand All @@ -169,7 +171,11 @@ var _ = Describe("Init", func() {
})
JustAfterEach(func() {
os.Setenv(terrascanConfigEnvName, "")
//remove the cloned repo at "invalid/path", (refer to 'path' in "config/invalid_path.toml")
os.RemoveAll("invalid")
})
// The current behavior of terrascan is that, when init command is being run with an invalid/
// non-existant base path, the specified path gets created and repoURL is cloned at that location
It("should download policies and exit with status code 0", func() {
initUtil.RunInitCommand(terrascanBinaryPath, outWriter, errWriter, helper.ExitCodeZero)
})
Expand All @@ -181,15 +187,16 @@ var _ = Describe("Init", func() {
})
JustAfterEach(func() {
os.Setenv(terrascanConfigEnvName, "")
//remove the cloned repo at "valid/path", (refer to 'path' in "config/valid_config.toml")
os.RemoveAll("valid")
})
It("init should download the repo provided in the config file", func() {
initUtil.RunInitCommand(terrascanBinaryPath, outWriter, errWriter, helper.ExitCodeZero)
})
Context("Kai Monkey git repo is downloaded", func() {
It("should validate Kai Monkey repo in the policy path", func() {
repo := initUtil.OpenGitRepo(defaultPolicyRepoPath)
initUtil.ValidateGitRepo(repo, kaiMoneyGitURL)
})
basePathInValidConfig := "valid/path"
// Kai Monkey git repo is downloaded
// validate Kai Monkey repo in the repo path
repo := initUtil.OpenGitRepo(basePathInValidConfig)
initUtil.ValidateGitRepo(repo, kaiMoneyGitURL)
})
})
})
Expand Down

0 comments on commit 70f3eb6

Please sign in to comment.