diff --git a/.github/workflows/ci-acctests.yml b/.github/workflows/ci-acctests.yml new file mode 100644 index 0000000..f028f23 --- /dev/null +++ b/.github/workflows/ci-acctests.yml @@ -0,0 +1,92 @@ + +name: CI-Acceptance-Tests + +on: + pull_request: + branches: [ main ] + push: + branches: [ main ] + repository_dispatch: + types: [acceptance-command] + +jobs: + Test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.15 + + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + - uses: actions/setup-python@v2 + with: + python-version: '3.7' + + - uses: actions/setup-node@v2 + with: + node-version: '14' + - name: Create comment + if: github.event_name == 'repository_dispatch' && github.event.action == 'acceptance-command' + uses: peter-evans/create-or-update-comment@v1 + with: + edit-mode: replace + comment-id: ${{ github.event.client_payload.github.payload.comment.id }} + body: | + **Edit:** :test_tube: [CI has Started acceptance Test]( https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) + reactions: eyes + - name: build binary + if: runner.os == 'Linux' || runner.os == 'macOS' + run: go build -o acceptance-tests/crda + + - name: build binary [Windows] + if: runner.os == 'Windows' + run: go build -o acceptance-tests/crda.exe + + - name: Install dependencies + run: go mod vendor + + - name: Run Tests + working-directory: ./acceptance-tests + env: + THREE_SCALE_KEY: ${{ secrets.THREE_SCALE_KEY }} + CRDA_KEY: ${{ secrets.CRDA_KEY }} + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} + run: ./test.sh + shell: bash + + - name: Upload log as artifact + if: always() + uses: actions/upload-artifact@v2 + with: + name: Test-log-${{ runner.os }} + path: ./acceptance-tests/logs.txt + - name: Create Success comment + if: github.event_name == 'repository_dispatch' && github.event.action == 'acceptance-command' + uses: peter-evans/create-or-update-comment@v1 + with: + edit-mode: replace + issue-number: ${{ github.event.client_payload.github.payload.issue.number }} + body: | + :v: [E2E Run Successfull](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) + reactions: hooray, heart + - name: Create fail comment + if: failure() && github.event_name == 'repository_dispatch' && github.event.action == 'acceptance-command' + uses: peter-evans/create-or-update-comment@v1 + with: + edit-mode: replace + comment-id: ${{ github.event.client_payload.github.payload.comment.id }} + body: | + **Edit:** :facepalm: [Acceptance Tests Failed]( https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) + reactions: confused + + \ No newline at end of file diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 6d3ce1e..04e3c4d 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -62,7 +62,7 @@ jobs: go mod tidy git diff --exit-code go.mod - name: Unit Test - run: go test -gcflags=-l -v -coverprofile=coverage.txt -covermode=atomic ./... + run: go test `go list ./... | grep -v acceptance-tests` -gcflags=-l -v -coverprofile=coverage.txt -covermode=atomic - name: Upload coverage to Codecov uses: codecov/codecov-action@v1 with: diff --git a/.github/workflows/slash-command.yml b/.github/workflows/slash-command.yml new file mode 100644 index 0000000..700ff33 --- /dev/null +++ b/.github/workflows/slash-command.yml @@ -0,0 +1,14 @@ +name: Slash Command Dispatch +on: + issue_comment: + types: [created] +jobs: + slashCommandDispatch: + runs-on: ubuntu-latest + steps: + - name: Slash Command Dispatch + uses: peter-evans/slash-command-dispatch@v2 + with: + token: ${{ secrets.CR_PAT }} + commands: | + acceptance diff --git a/.gitignore b/.gitignore index 512d9f7..06ae14a 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,13 @@ .DS_Store .devcontainer +.env +data/ +*.coverprofile +logs.txt +coverage/ +.ginkgo.report + # Python excludes because bilingual repository __pycache__/ diff --git a/acceptance-tests/Dockerfile b/acceptance-tests/Dockerfile new file mode 100644 index 0000000..a5965f9 --- /dev/null +++ b/acceptance-tests/Dockerfile @@ -0,0 +1,19 @@ +FROM registry.access.redhat.com/ubi8/go-toolset + +USER root +WORKDIR /tests +COPY . /tests +RUN go get github.com/onsi/ginkgo/ginkgo +RUN go get github.com/onsi/gomega/... +RUN yum -y update +RUN yum install -y maven +RUN yum install -y java-1.8.0-openjdk +RUN mvn --version +RUN yum install -y python36; yum clean all && ln -s /usr/bin/python3 /usr/bin/python +RUN yum install -y python3-pip +RUN python3 -V +RUN python3 -m pip -V +RUN pip3 -V +RUN rpm -i https://github.com/fabric8-analytics/cli-tools/releases/download/v0.1.0/crda_0.1.0_Linux-64bit.rpm + +ENTRYPOINT [ "/tests/test.sh" ] \ No newline at end of file diff --git a/acceptance-tests/acceptance_tests_suite_test.go b/acceptance-tests/acceptance_tests_suite_test.go new file mode 100644 index 0000000..cec8ebf --- /dev/null +++ b/acceptance-tests/acceptance_tests_suite_test.go @@ -0,0 +1,25 @@ +package acceptance_tests_test + +import ( + "testing" + "time" + + "github.com/fabric8-analytics/cli-tools/acceptance-tests/helper" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +func TestAcceptanceTests(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "AcceptanceTests Suite") +} + +var _ = BeforeSuite(func() { + SetDefaultEventuallyTimeout(1 * time.Minute) + helper.CreateDataDir() + helper.CheckforSynkToken() +}) + +var _ = AfterSuite(func() { + helper.CleanupSuite() +}) \ No newline at end of file diff --git a/acceptance-tests/acceptance_tests_test.go b/acceptance-tests/acceptance_tests_test.go new file mode 100644 index 0000000..f3b9260 --- /dev/null +++ b/acceptance-tests/acceptance_tests_test.go @@ -0,0 +1,14 @@ +package acceptance_tests_test + +import ( + "github.com/fabric8-analytics/cli-tools/acceptance-tests/tests" + . "github.com/onsi/ginkgo" +) + +var _ = Describe("AcceptanceTests", func() { + + Describe("PR ACCEPTANCE TESTS", tests.PrCheckSuite) + + Describe("NIGHTLY SUITE", tests.NightlySuite) + +}) diff --git a/acceptance-tests/helper/helper.go b/acceptance-tests/helper/helper.go new file mode 100644 index 0000000..fc87299 --- /dev/null +++ b/acceptance-tests/helper/helper.go @@ -0,0 +1,166 @@ +package helper + +import ( + "errors" + "fmt" + "io" + "os" + "os/exec" + "path/filepath" + "strings" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gexec" +) + +// runningCmd is the function which logs the running command +func runningCmd(cmd *exec.Cmd) string { + prog := filepath.Base(cmd.Path) + return fmt.Sprintf("Running %s with args %v", prog, cmd.Args) +} + +// PrintWithGinkgo is the function used for logging +func PrintWithGinkgo(data string){ + prefix := fmt.Sprintf("[%s] ", "Test Log") + prefixWriter := gexec.NewPrefixedWriter(prefix, GinkgoWriter) + fmt.Fprintln(prefixWriter, data) +} + +// CmdRunner is the function used to run a command +func CmdRunner(program string, args ...string) *gexec.Session { + //prefix ginkgo verbose output with program name + prefix := fmt.Sprintf("[%s] ", filepath.Base(program)) + prefixWriter := gexec.NewPrefixedWriter(prefix, GinkgoWriter) + command := exec.Command(program, args...) + fmt.Fprintln(GinkgoWriter, runningCmd(command)) + session, err := gexec.Start(command, prefixWriter, prefixWriter) + Expect(err).NotTo(HaveOccurred()) + return session +} + +// CmdShouldPassWithExit2 asserts the command passed with exit 2 +func CmdShouldPassWithExit2(program string, args ...string) string { + session := CmdRunner(program, args...) + Eventually(session).Should(gexec.Exit(2), runningCmd(session.Command)) + return string(session.Out.Contents()) +} + +// CmdShouldPassWithExit1 asserts the command passed with exit 1 +func CmdShouldPassWithExit1(program string, args ...string) string { + session := CmdRunner(program, args...) + Eventually(session).Should(gexec.Exit(1), runningCmd(session.Command)) + return string(session.Out.Contents()) +} + +// CmdShouldFailWithExit1 asserts the command passed with exit 1 +func CmdShouldFailWithExit1(program string, args ...string) string { + session := CmdRunner(program, args...) + Eventually(session).Should(gexec.Exit(1), runningCmd(session.Command)) + return string(session.Err.Contents()) +} + +// CmdShouldPassWithoutError asserts if the command is passed without error +func CmdShouldPassWithoutError(program string, args ...string) string { + session := CmdRunner(program, args...) + Eventually(session).ShouldNot(gexec.Exit(1),runningCmd(session.Command)) + Eventually(session).ShouldNot(gexec.Exit(2),runningCmd(session.Command)) + Eventually(session).Should(gexec.Exit(), runningCmd(session.Command)) + return string(session.Out.Contents()) +} + +// Getabspath Gets the Absolute Path +func Getabspath(path string) (string, error) { + if path == "" { + return "", errors.New("empty file path supplied") + } + cmd := exec.Command("pwd") + stdout, err := cmd.Output() + if err != nil { + return "", errors.New("cannot run PWD") + } + pwd := string(stdout) + pwd = strings.TrimSpace(pwd) + result := pwd + path + return result, nil + +} + +// CommonBeforeEach is a common before each function +func CommonBeforeEach(file string, target string) (string, string) { + + if target == "npm" { + return file, "/package.json" + }else if target == "pypi"{ + return file, "/requirements.txt" + }else if target == "go"{ + return file, "/go.mod" + }else if target == "maven"{ + return file, "/pom.xml" + }else { + return "", "" + } +} + +// CheckforSynkToken Checks for Snyk Token var in env +func CheckforSynkToken() { + _, present := os.LookupEnv("snyk_token") + if !present { + fmt.Printf("snyk token env variable not present") + os.Exit(1) + } else { + fmt.Println("Snyk Token var present.. Starting Test Suite") + } +} + +// CreateDataDir creates data directory +func CreateDataDir() error { + err := os.Mkdir("data", 0755) + if err != nil { + return err + } + return nil +} + +// CleanupSuite deletes files used by tests +func CleanupSuite() error { + err := os.RemoveAll("data") + if err != nil { + return err + } + return nil +} + +// Cleanup global cleanup function +func Cleanup(path string) error { + contents, err := filepath.Glob(path) + if err != nil { + return err + } + for _, item := range contents { + err = os.RemoveAll(item) + if err != nil { + return err + } + } + return nil +} + +// CopyContentstoTarget Copies the files to target +func CopyContentstoTarget(filename string, target string) error { + from, err := os.Open(filename) + if err != nil { + return err + } + defer from.Close() + + to, err := os.OpenFile(target, os.O_RDWR|os.O_CREATE, 0666) + if err != nil { + return err + } + defer to.Close() + _, err = io.Copy(to, from) + if err != nil { + return err + } + return nil +} diff --git a/acceptance-tests/manifests/go.mod.template b/acceptance-tests/manifests/go.mod.template new file mode 100644 index 0000000..8bd56e0 --- /dev/null +++ b/acceptance-tests/manifests/go.mod.template @@ -0,0 +1,13 @@ +module github.com/fabric8-analytics/acceptance_tests/data + +go 1.14 + +require ( + code.cloudfoundry.org/archiver v0.0.0-20170223024658-7291196139d7 + github.com/googleapis/gax-go v1.0.3 + github.com/googleapis/gax-go/v2 v2.0.5 + github.com/onsi/ginkgo v1.14.2 // indirect + github.com/onsi/gomega v1.10.3 // indirect + github.com/slackhq/nebula v1.1.0 + github.com/stretchr/testify v1.6.1 // indirect +) diff --git a/acceptance-tests/manifests/go2.mod.template b/acceptance-tests/manifests/go2.mod.template new file mode 100644 index 0000000..0e09344 --- /dev/null +++ b/acceptance-tests/manifests/go2.mod.template @@ -0,0 +1,12 @@ +module github.com/fabric8-analytics/acceptance_tests/data + +go 1.14 + +require ( + code.cloudfoundry.org/archiver v0.0.0-20170223024658-7291196139d7 + github.com/googleapis/gax-go v1.0.3 + github.com/googleapis/gax-go/v2 v2.0.5 + github.com/onsi/ginkgo v1.14.2 // indirect + github.com/onsi/gomega v1.10.3 // indirect + github.com/stretchr/testify v1.6.1 // indirect +) diff --git a/acceptance-tests/manifests/main.go.template b/acceptance-tests/manifests/main.go.template new file mode 100644 index 0000000..a1c6fd8 --- /dev/null +++ b/acceptance-tests/manifests/main.go.template @@ -0,0 +1,16 @@ +package main + +import "fmt" + +// import _ "github.com/unknwon/cae" +// import _ "github.com/unknwon/cae/zip" +import _ "github.com/slackhq/nebula/cert" + +import _ "github.com/slackhq/nebula" +import _ "code.cloudfoundry.org/archiver/extractor" +import _ "github.com/googleapis/gax-go" +import _ "github.com/googleapis/gax-go/v2" + +func main() { + fmt.Println("vim-go") +} \ No newline at end of file diff --git a/acceptance-tests/manifests/main2.go.template b/acceptance-tests/manifests/main2.go.template new file mode 100644 index 0000000..59a2dba --- /dev/null +++ b/acceptance-tests/manifests/main2.go.template @@ -0,0 +1,14 @@ +package main + +import "fmt" + +// import _ "github.com/unknwon/cae" +// import _ "github.com/unknwon/cae/zip" + +import _ "code.cloudfoundry.org/archiver/extractor" +import _ "github.com/googleapis/gax-go" +import _ "github.com/googleapis/gax-go/v2" + +func main() { + fmt.Println("vim-go") +} \ No newline at end of file diff --git a/acceptance-tests/manifests/package.json b/acceptance-tests/manifests/package.json new file mode 100644 index 0000000..4fcb95b --- /dev/null +++ b/acceptance-tests/manifests/package.json @@ -0,0 +1,36 @@ +{ + "name": "node-js-sample", + "version": "0.2.0", + "description": "A sample Node.js app using Express 4", + "main": "index.js", + "scripts": { + "start": "node index.js" + }, + "dependencies": { + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.5.0", + "cordova-plugin-camera": "4.1.0", + "bootstrap": "4.1.1", + "libnmap": "0.4.15", + "lodash": "4.17.11", + "html-purify": "1.1.0" + }, + "engines": { + "node": "4.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/heroku/node-js-sample" + }, + "keywords": [ + "node", + "heroku", + "express" + ], + "author": "Mark Pundsack", + "contributors": [ + "Zeke Sikelianos (http://zeke.sikelianos.com)" + ], + "license": "MIT" +} \ No newline at end of file diff --git a/acceptance-tests/manifests/pom.xml b/acceptance-tests/manifests/pom.xml new file mode 100644 index 0000000..94818a5 --- /dev/null +++ b/acceptance-tests/manifests/pom.xml @@ -0,0 +1,13 @@ + + 4.0.0 + com.redhat.bayessian.test + test-app-junit-dependency + 1.0 + + + junit + junit + 3.8.1 + + + diff --git a/acceptance-tests/manifests/pom2.xml b/acceptance-tests/manifests/pom2.xml new file mode 100644 index 0000000..8cab42a --- /dev/null +++ b/acceptance-tests/manifests/pom2.xml @@ -0,0 +1,707 @@ + + + 4.0.0 + + io.openshift + booster-parent + 8 + + com.example + space00005 + 1.0.0-SNAPSHOT + Vert.x - HTTP + Exposes an HTTP API using Vert.x + + + Apache License, Version 2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + repo + A business-friendly OSS license + + + + + + io.vertx + vertx-codegen + 3.4.2 + + + io.vertx + vertx-codegen + 3.4.2 + processor + + + io.vertx + vertx-codegen + 3.4.2 + sources + + + io.vertx + vertx-codegen + 3.4.2 + tck + + + io.vertx + vertx-codegen + 3.4.2 + tck-sources + + + io.vertx + vertx-docgen + 3.4.2 + + + io.vertx + vertx-core + 3.4.2 + + + io.vertx + vertx-core + 3.4.2 + sources + + + io.vertx + vertx-codetrans + 3.4.2 + + + io.vertx + vertx-core + 3.4.2 + test-jar + + + io.vertx + vertx-hazelcast + 3.4.2 + + + io.vertx + vertx-zookeeper + 3.4.2 + + + io.vertx + vertx-lang-js + 3.4.2 + + + io.vertx + vertx-lang-groovy + 3.4.2 + + + io.vertx + vertx-lang-ruby + 3.4.2 + + + io.vertx + vertx-lang-ceylon-parent + 3.4.2 + + + io.vertx + vertx-lang-ceylon + 3.4.2 + + + io.vertx + vertx-lang-kotlin-parent + 3.4.2 + + + io.vertx + vertx-lang-kotlin + 3.4.2 + + + io.vertx + vertx-lang-kotlin-compiler + 3.4.2 + + + io.vertx + vertx-unit + 3.4.2 + + + io.vertx + vertx-consul + 3.4.2 + + + io.vertx + vertx-consul-client + 3.4.2 + + + io.vertx + vertx-consul-service + 3.4.2 + + + io.vertx + vertx-mongo-embedded-db + 3.4.2 + + + io.vertx + vertx-mongo + 3.4.2 + + + io.vertx + vertx-mongo-client + 3.4.2 + + + io.vertx + vertx-mongo-service + 3.4.2 + + + io.vertx + vertx-sql-common + 3.4.2 + + + io.vertx + vertx-jdbc-client + 3.4.2 + + + io.vertx + vertx-reactive-streams + 3.4.2 + + + io.vertx + vertx-service-proxy + 3.4.2 + + + io.vertx + vertx-service-proxy + 3.4.2 + processor + + + io.vertx + vertx-service-factory + 3.4.2 + + + io.vertx + vertx-maven-service-factory-parent + 3.4.2 + + + io.vertx + vertx-maven-service-factory + 3.4.2 + + + io.vertx + vertx-http-service-factory + 3.4.2 + + + io.vertx + vertx-dropwizard-metrics + 3.4.2 + + + io.vertx + vertx-hawkular-metrics + 3.4.2 + + + io.vertx + vertx-health-check + 3.4.2 + + + io.vertx + vertx-rx + 3.4.2 + + + io.vertx + vertx-rx-java + 3.4.2 + + + io.vertx + vertx-rx-js + 3.4.2 + + + io.vertx + vertx-rx-groovy + 3.4.2 + + + io.vertx + vertx-auth + 3.4.2 + + + io.vertx + vertx-auth-common + 3.4.2 + + + io.vertx + vertx-auth-htdigest + 3.4.2 + + + io.vertx + vertx-auth-jdbc + 3.4.2 + + + io.vertx + vertx-auth-shiro + 3.4.2 + + + io.vertx + vertx-auth-oauth2 + 3.4.2 + + + io.vertx + vertx-auth-jwt + 3.4.2 + + + io.vertx + vertx-auth-mongo + 3.4.2 + + + io.vertx + vertx-web-parent + 3.4.2 + + + io.vertx + vertx-web + 3.4.2 + + + io.vertx + vertx-web-common + 3.4.2 + + + io.vertx + vertx-web-client + 3.4.2 + + + io.vertx + vertx-web-templ-thymeleaf + 3.4.2 + + + io.vertx + vertx-web-templ-handlebars + 3.4.2 + + + io.vertx + vertx-web-templ-jade + 3.4.2 + + + io.vertx + vertx-web-templ-mvel + 3.4.2 + + + io.vertx + vertx-web-templ-pebble + 3.4.2 + + + io.vertx + vertx-web-templ-freemarker + 3.4.2 + + + io.vertx + vertx-web-templ-thymeleaf + 3.4.2 + shaded + + + io.vertx + vertx-web-templ-handlebars + 3.4.2 + shaded + + + io.vertx + vertx-web-templ-jade + 3.4.2 + shaded + + + io.vertx + vertx-web-templ-mvel + 3.4.2 + shaded + + + io.vertx + vertx-web-templ-pebble + 3.4.2 + shaded + + + io.vertx + vertx-web-templ-freemarker + 3.4.2 + shaded + + + io.vertx + vertx-sockjs-service-proxy + 3.4.2 + + + io.vertx + vertx-jca + 3.4.2 + + + io.vertx + vertx-jca-api + 3.4.2 + + + io.vertx + vertx-jca-adapter + 3.4.2 + + + io.vertx + vertx-mail + 3.4.2 + + + io.vertx + vertx-mail-client + 3.4.2 + + + io.vertx + vertx-mail-service + 3.4.2 + + + io.vertx + vertx-redis-client + 3.4.2 + + + io.vertx + vertx-sync + 3.4.2 + + + io.vertx + vertx-stomp + 3.4.2 + + + io.vertx + vertx-shell + 3.4.2 + + + io.vertx + vertx-tcp-eventbus-bridge + 3.4.2 + + + io.vertx + vertx-bridge-common + 3.4.2 + + + io.vertx + vertx-jgroups + 3.4.2 + + + io.vertx + vertx-infinispan + 3.4.2 + + + io.vertx + vertx-mysql-postgresql-client + 3.4.2 + + + io.vertx + vertx-camel-bridge + 3.4.2 + + + io.vertx + vertx-ignite + 3.4.2 + + + io.vertx + vertx-rabbitmq-client + 3.4.2 + + + io.vertx + vertx-proton + 3.4.2 + + + io.vertx + vertx-amqp-bridge + 3.4.2 + + + io.vertx + vertx-kafka-client + 3.4.2 + + + io.vertx + vertx-circuit-breaker + 3.4.2 + + + io.vertx + vertx-service-discovery + 3.4.2 + + + io.vertx + vertx-service-discovery-parent + 3.4.2 + + + io.vertx + vertx-service-discovery-bridge-kubernetes + 3.4.2 + + + io.vertx + vertx-service-discovery-bridge-docker + 3.4.2 + + + io.vertx + vertx-service-discovery-bridge-docker-links + 3.4.2 + + + io.vertx + vertx-service-discovery-bridge-consul + 3.4.2 + + + io.vertx + vertx-service-discovery-backend-redis + 3.4.2 + + + io.vertx + vertx-config-parent + 3.4.2 + + + io.vertx + vertx-config + 3.4.2 + + + io.vertx + vertx-config-git + 3.4.2 + + + io.vertx + vertx-config-hocon + 3.4.2 + + + io.vertx + vertx-config-kubernetes-configmap + 3.4.2 + + + io.vertx + vertx-config-redis + 3.4.2 + + + io.vertx + vertx-config-spring-config-server + 3.4.2 + + + io.vertx + vertx-config-yaml + 3.4.2 + + + io.vertx + vertx-config-zookeeper + 3.4.2 + + + io.vertx + vertx-grpc + 3.4.2 + + + io.vertx + vertx-mqtt-server + 3.4.2 + + + io.netty + netty-common + 4.1.8.Final + + + io.netty + netty-buffer + 4.1.8.Final + + + io.netty + netty-transport + 4.1.8.Final + + + io.netty + netty-handler + 4.1.8.Final + + + io.netty + netty-handler-proxy + 4.1.8.Final + + + io.netty + netty-codec-http + 4.1.8.Final + + + io.netty + netty-codec-http2 + 4.1.8.Final + + + io.netty + netty-resolver + 4.1.8.Final + + + io.netty + netty-resolver-dns + 4.1.8.Final + + + io.netty + netty-codec-mqtt + 4.1.8.Final + + + io.netty + netty-tcnative-boringssl-static + 1.1.33.Fork26 + test + + + com.fasterxml.jackson.core + jackson-core + 2.7.4 + + + com.fasterxml.jackson.core + jackson-databind + 2.7.4 + + + + + + io.vertx + vertx-core + 3.4.2 + compile + + + io.vertx + vertx-web + 3.4.2 + compile + + + io.vertx + vertx-web-client + 3.4.2 + test + + + io.vertx + vertx-unit + 3.4.2 + test + + + junit + junit + 4.12 + test + + + org.assertj + assertj-core + 3.6.2 + test + + + com.jayway.restassured + rest-assured + 2.9.0 + test + + + com.jayway.awaitility + awaitility + 1.7.0 + test + + + io.openshift + openshift-test-utils + 2 + test + + + diff --git a/acceptance-tests/manifests/requirements.txt b/acceptance-tests/manifests/requirements.txt new file mode 100644 index 0000000..8faae20 --- /dev/null +++ b/acceptance-tests/manifests/requirements.txt @@ -0,0 +1,4 @@ +flask==0.12 +fastapi==0.36.0 +sceptre==2.2.1 + diff --git a/acceptance-tests/manifests/requirements2.txt b/acceptance-tests/manifests/requirements2.txt new file mode 100644 index 0000000..11f85de --- /dev/null +++ b/acceptance-tests/manifests/requirements2.txt @@ -0,0 +1,10 @@ +behave==1.2.5 +boto3==1.4.6 +botocore==1.6.6 # via boto3, s3transfer +docker-py==1.10.6 +docker-pycreds==0.2.1 # via docker-py +docutils==0.14 # via botocore +jmespath==0.9.3 # via boto3, botocore +jsonschema==2.5.1 +parse-type==0.3.4 # via behave +parse==1.6.6 # via behave, parse-type \ No newline at end of file diff --git a/acceptance-tests/manifests/vulns.json b/acceptance-tests/manifests/vulns.json new file mode 100644 index 0000000..fe1bfff --- /dev/null +++ b/acceptance-tests/manifests/vulns.json @@ -0,0 +1,35 @@ +{ + "name": "word-finder", + "version": "0.0.4-28", + "description": "A website that will help you with 'Whats the Phrase' and 'Words With Friends'", + "main": "server.js", + "scripts": { + "start": "node start.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/amirrajan/word-finder.git" + }, + "dependencies": { + "moment": "2.24.0", + "request": "2.88.0" + }, + "old_dependencies": { + "babel-core": "^6.7.7", + "babel-preset-es2015": "^6.6.0", + "babel-register": "^6.7.2", + "body-parser": "^1.15.0", + "ejs": "~1.0.0", + "express": "~4.13.4", + "jasmine-node": "~1.11", + "lodash": "^4.11.1" + }, + "subdomain": "word-finder", + "engines": { + "node": ">=0.8.x" + }, + "devDependencies": { + "babel-core": "^6.7.7" + } + } + \ No newline at end of file diff --git a/acceptance-tests/test.sh b/acceptance-tests/test.sh new file mode 100755 index 0000000..2d998fd --- /dev/null +++ b/acceptance-tests/test.sh @@ -0,0 +1,15 @@ +#!/bin/bash -ex +set -exv + +mkdir -p $HOME/.crda + +export AUTH_TOKEN=${THREE_SCALE_KEY:-3e42fa66f65124e6b1266a23431e3d08}; +export CRDA_KEY=${CRDA_KEY:-d931dd95-ab1f-4f74-9a9f-fb50f60e4ea9}; +export HOST=https://f8a-analytics-preview-2445582058137.staging.gw.apicast.io +export snyk_token=${SNYK_TOKEN} + +printf 'auth_token: %s\nconsent_telemetry: false\ncrda_key: %s\nhost: %s' "${AUTH_TOKEN}" "${CRDA_KEY}" "${HOST}" >> $HOME/.crda/config.yaml + +cat $HOME/.crda/config.yaml + +go test -test.v -ginkgo.failFast -ginkgo.reportFile ginkgo.report -ginkgo.focus="PR ACCEPTANCE TESTS" \ No newline at end of file diff --git a/acceptance-tests/tests/auth.go b/acceptance-tests/tests/auth.go new file mode 100644 index 0000000..6c8a50b --- /dev/null +++ b/acceptance-tests/tests/auth.go @@ -0,0 +1,36 @@ +package tests + +import ( + "os" + "github.com/fabric8-analytics/cli-tools/acceptance-tests/helper" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +// TestCRDAauth implements Test Cases to test auth crda command +func TestCRDAauth() { + When("I run crda auth without snyk token", func() { + It("should throw error", func() { + session := helper.CmdShouldFailWithExit1(getCRDAcmd(), "auth", "--snyk-token") + Expect(string(session)).To(ContainSubstring("flag needs an argument: --snyk-token")) + }) + }) + When("I run crda auth with invalid snyk token", func() { + It("it should throw error", func() { + session := helper.CmdShouldFailWithExit1(getCRDAcmd(), "auth", "--snyk-token", "invalid-token") + Expect(string(session)).To(ContainSubstring("Snyk API Token is invalid")) + }) + + }) + When("I run crda auth with valid snyk token", func() { + validToken := os.Getenv("snyk_token") + It("it should not throw error", func() { + if validToken== ""{ + Skip("Running in PR Check") + } + session := helper.CmdShouldPassWithoutError(getCRDAcmd(), "auth", "--snyk-token", string(validToken)) + helper.PrintWithGinkgo(session) + }) + + }) +} diff --git a/acceptance-tests/tests/basic_commands.go b/acceptance-tests/tests/basic_commands.go new file mode 100644 index 0000000..77ce8b4 --- /dev/null +++ b/acceptance-tests/tests/basic_commands.go @@ -0,0 +1,95 @@ +package tests + +import ( + "runtime" + "github.com/fabric8-analytics/cli-tools/acceptance-tests/helper" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +// TestCRDAVersion checks for version command +func TestCRDAVersion() { + + It("Runs and Validate CLI version", func() { + session := helper.CmdShouldPassWithoutError(getCRDAcmd(), "analyse", "version") + helper.PrintWithGinkgo(session) + + }) + +} + +// TestInvalidPath checks for invalid path error +func TestInvalidPath() { + It("Should throw error if i send invalid file path", ValidateInvalidFilePath) +} + +// TestInvalidCommand checks for invalid sub command +func TestInvalidCommand() { + It("Should throw error when run an invalid command", ValidateInvalidCommand) +} + +// TestInvalidFlag checks for an invalid flag +func TestInvalidFlag() { + It("Should throw an error when set an invalid flag", ValidateInvalidFlag) +} + +// TestCRDAHelp verifies the help command +func TestCRDAHelp() { + It("Runs and Validate Help command", func() { + session := helper.CmdShouldPassWithoutError(getCRDAcmd(), "analyse", "help") + helper.PrintWithGinkgo(session) + + }) + +} + +// TestCRDACompletion verifies the completion command +func TestCRDACompletion() { + It("Runs and Validate completion command", func() { + if runtime.GOOS == "darwin" || runtime.GOOS == "linux" { + _ = helper.CmdShouldPassWithoutError(getCRDAcmd(), "completion", "bash") + } else if runtime.GOOS == "windows" { + _ = helper.CmdShouldPassWithoutError(getCRDAcmd(), "completion", "powershell") + } else { + Skip("No supporting operating system") + } + }) +} + +// TestCRDAallCommandsHelp verifies if there is a help page for all sub commands +func TestCRDAallCommandsHelp() { + It("analyse command has help page", func() { + session := helper.CmdShouldPassWithoutError(getCRDAcmd(), "analyse", "--help") + helper.PrintWithGinkgo(session) + }) + It("auth command has help page", func() { + session := helper.CmdShouldPassWithoutError(getCRDAcmd(), "auth", "--help") + helper.PrintWithGinkgo(session) + + }) + It("completion command has help page", func() { + session := helper.CmdShouldPassWithoutError(getCRDAcmd(), "completion", "--help") + helper.PrintWithGinkgo(session) + + }) + It("version command has help page", func() { + session := helper.CmdShouldPassWithoutError(getCRDAcmd(), "version", "--help") + helper.PrintWithGinkgo(session) + + }) + It("help command has help page", func() { + session := helper.CmdShouldPassWithoutError(getCRDAcmd(), "help", "--help") + helper.PrintWithGinkgo(session) + + }) +} + +// TestCRDAanalyseWithoutFile veifies error when no file is provided +func TestCRDAanalyseWithoutFile() { + It("Validate analyse without flile throws error", func() { + session := helper.CmdShouldFailWithExit1(getCRDAcmd(), "analyse") + helper.PrintWithGinkgo(session) + Expect(string(session)).To(ContainSubstring("requires valid manifest file path")) + + }) +} diff --git a/acceptance-tests/tests/common.go b/acceptance-tests/tests/common.go new file mode 100644 index 0000000..5d7a031 --- /dev/null +++ b/acceptance-tests/tests/common.go @@ -0,0 +1,201 @@ +package tests + +import ( + "os/exec" + "runtime" + "github.com/fabric8-analytics/cli-tools/acceptance-tests/helper" + . "github.com/onsi/gomega" +) + + +// Path and all the other global vars +var ( + Path string = "/data" + pwd string + err error + manifests string = "/manifests" + file string = "/package.json" + target string = "/package.json" + GoMainFile string = "/main.go.template" + GoMainFileT string = "/main.go" +) + +// getCRDAcmd returns the command according to os +func getCRDAcmd() string { + if runtime.GOOS == "darwin" || runtime.GOOS == "linux" { + return "./crda" + } else if runtime.GOOS == "windows" { + return "./crda.exe" + } + return "crda" +} + +// GetAbsPath returns absolute path +func GetAbsPath() { + pwd, err = helper.Getabspath(Path) + if err != nil { + helper.PrintWithGinkgo(err.Error()) + } +} + +// InitVirtualEnv makes a new virtual env for python +func InitVirtualEnv() { + cmd := exec.Command("/bin/sh", "-c", "cd "+pwd+"; python3 -m venv env; source env/bin/activate; pip3 install -r requirements.txt;") + stdout, err := cmd.Output() + helper.PrintWithGinkgo(string(stdout)) + if err != nil { + helper.PrintWithGinkgo(err.Error()) + } +} + +// InstallNpmDeps runs npm install +func InstallNpmDeps() { + cmd := exec.Command("npm", "install") + cmd.Dir = "data" + stdout, err := cmd.Output() + helper.PrintWithGinkgo(string(stdout)) + if err != nil { + helper.PrintWithGinkgo(err.Error()) + } +} + +// RunGoModTidy runs the tidy command +func RunGoModTidy() { + cmd := exec.Command("go", "mod", "tidy") + cmd.Dir = "data" + stdout, err := cmd.Output() + helper.PrintWithGinkgo(string(stdout)) + if err != nil { + helper.PrintWithGinkgo(err.Error()) + } +} + +// RunPipInstall runs pip install command +func RunPipInstall() { + cmd := exec.Command("pip", "install", "-r", "requirements.txt") + cmd.Dir = "data" + stdout, err := cmd.Output() + helper.PrintWithGinkgo(string(stdout)) + if err != nil { + helper.PrintWithGinkgo(err.Error()) + } +} + +// ValidateAnalse runs analyse command +func ValidateAnalse() { + session := helper.CmdShouldPassWithExit2(getCRDAcmd(), "analyse","data"+target) + helper.PrintWithGinkgo(session) +} + +// ValidateAnalseNoVulns runs analyse command +func ValidateAnalseNoVulns() { + session := helper.CmdShouldPassWithoutError(getCRDAcmd(), "analyse","data"+target) + helper.PrintWithGinkgo(session) +} + +// ValidateAnalseJSONVulns runs analyse command with json +func ValidateAnalseJSONVulns() { + session := helper.CmdShouldPassWithExit2(getCRDAcmd(), "analyse","data"+target, "-j") + helper.PrintWithGinkgo(session) + +} + +// ValidateAnalseJSONNoVulns runs analyse command with json no vulns +func ValidateAnalseJSONNoVulns() { + session := helper.CmdShouldPassWithoutError(getCRDAcmd(), "analyse","data"+target, "-j") + helper.PrintWithGinkgo(session) + + +} + +// ValidateAnalseVulnVerbose runs analyse command with verbose +func ValidateAnalseVulnVerbose() { + session := helper.CmdShouldPassWithoutError(getCRDAcmd(), "analyse","data"+target, "-v") + helper.PrintWithGinkgo(session) + +} + +// ValidateInvalidFilePath runs analyse command with invalid file path +func ValidateInvalidFilePath() { + session := helper.CmdShouldFailWithExit1(getCRDAcmd(), "analyse","/package.json") + helper.PrintWithGinkgo(session) + Expect(string(session)).To(ContainSubstring("invalid file path: /package.json")) +} + +// ValidateInvalidCommand runs invalid command +func ValidateInvalidCommand() { + session := helper.CmdShouldPassWithoutError(getCRDAcmd(), "analyseess") + helper.PrintWithGinkgo(session) +} + +// ValidateInvalidFlag runs analyse command with invalid flag +func ValidateInvalidFlag() { + session := helper.CmdShouldFailWithExit1(getCRDAcmd(), "analyse","-y") + helper.PrintWithGinkgo(session) + Expect(string(session)).To(ContainSubstring("unknown shorthand flag: 'y' in -y")) +} + +// ValidateAnalseVulnDebug runs analyse command with debug +func ValidateAnalseVulnDebug() { + session := helper.CmdShouldPassWithoutError(getCRDAcmd(), "analyse","data"+target, "-d") + helper.PrintWithGinkgo(session) +} + +// ValidateAnalseAllFlags runs analyse command with all flags set true +func ValidateAnalseAllFlags() { + session := helper.CmdShouldPassWithExit2(getCRDAcmd(), "analyse", "data"+target, "-v", "-j", "-d") + helper.PrintWithGinkgo(session) +} + +// Cleanup cleans the data dir +func Cleanup(){ + err := helper.Cleanup("data/*") + if err != nil { + helper.PrintWithGinkgo(err.Error()) + } +} + +// CopyManifests copies manifests to data dir +func CopyManifests() { + dir1, err := helper.Getabspath(manifests) + if err != nil { + helper.PrintWithGinkgo(err.Error()) + } + dir2, err := helper.Getabspath(Path) + if err != nil { + helper.PrintWithGinkgo(err.Error()) + } + helper.PrintWithGinkgo(dir1+ file) + helper.PrintWithGinkgo(dir2 + target) + err = helper.CopyContentstoTarget("manifests"+file, "data"+target) + Expect(err).NotTo(HaveOccurred()) +} + +// CopyManinfile copies go main file to target +func CopyManinfile() { + dir1, err := helper.Getabspath(manifests) + if err != nil { + helper.PrintWithGinkgo(err.Error()) + } + dir2, err := helper.Getabspath(Path) + if err != nil { + helper.PrintWithGinkgo(err.Error()) + } + helper.PrintWithGinkgo(dir1 + GoMainFile) + helper.PrintWithGinkgo(dir2 + GoMainFileT) + err = helper.CopyContentstoTarget("manifests"+GoMainFile, "data"+GoMainFileT) + Expect(err).NotTo(HaveOccurred()) +} + +// RunAnalyseAbsolute runs analyse with abs path +func RunAnalyseAbsolute() { + if runtime.GOOS == "windows" { + session := helper.CmdShouldPassWithExit2(getCRDAcmd(), "analyse", "data"+target) + helper.PrintWithGinkgo(session) + } else { + session := helper.CmdShouldPassWithExit2(getCRDAcmd(), "analyse", pwd+target) + helper.PrintWithGinkgo(session) + } + + +} diff --git a/acceptance-tests/tests/controller.go b/acceptance-tests/tests/controller.go new file mode 100644 index 0000000..35f7dc4 --- /dev/null +++ b/acceptance-tests/tests/controller.go @@ -0,0 +1,43 @@ +package tests + +import ( + . "github.com/onsi/ginkgo" +) + +// PrCheckSuite runs checks on every PR +func PrCheckSuite() { + + When("Run Crda version", TestCRDAVersion) + When("Test CRDA auth command", TestCRDAauth) + When("Test for invalid path throws error", TestInvalidPath) + When("Test for invalid command", TestInvalidCommand) + When("Test for invalid flag throws error", TestInvalidFlag) + When("Run Crda help", TestCRDAHelp) + When("Validate CRDA completion command by os", TestCRDACompletion) + When("Validate there is a help page for all commands", TestCRDAallCommandsHelp) + When("Run Crda analyse without any file", TestCRDAanalyseWithoutFile) + When("Test CRDA analyse Go", GolangTestSuitePR) + When("Test CRDA analyse Maven", MavenTestSuitePR) + When("Test CRDA analyse Npm", NpmTestSuitePR) + When("Test CRDA analyse Pypi", PypiTestSuitePR) + +} + +// NightlySuite runs checks on every PR +func NightlySuite() { + + When("Test CRDA auth command", TestCRDAauth) + When("Test for invalid path throws error", TestInvalidPath) + When("Test for invalid command", TestInvalidCommand) + When("Test for invalid flag throws error", TestInvalidFlag) + When("Run Crda version", TestCRDAVersion) + When("Run Crda help", TestCRDAHelp) + When("Validate CRDA completion command by os", TestCRDACompletion) + When("Validate there is a help page for all commands", TestCRDAallCommandsHelp) + When("Run Crda analyse without any file", TestCRDAanalyseWithoutFile) + When("Test CRDA analyse Maven", MavenTestSuite) + When("Test CRDA analyse Npm", NpmTestSuite) + When("Test CRDA analyse Go", GolangTestSuite) + When("Test CRDA analyse Pypi", PypiTestSuite) + +} diff --git a/acceptance-tests/tests/golang_tests.go b/acceptance-tests/tests/golang_tests.go new file mode 100644 index 0000000..9eb9fd2 --- /dev/null +++ b/acceptance-tests/tests/golang_tests.go @@ -0,0 +1,106 @@ +package tests + +import ( + "github.com/fabric8-analytics/cli-tools/acceptance-tests/helper" + . "github.com/onsi/ginkgo" +) + +// BasicTestGO tests Basic Go functionality +func BasicTestGO() { + + It("I should Copy Manifest", CopyManifests) + It("I should be able to copy the main file", CopyManinfile) + It("I should able to run go mod tidy", RunGoModTidy) + It("I Should be able to run analyse without error", ValidateAnalse) + It("I should perform cleanup", Cleanup) + +} + +// TestCRDAanalyseWithAbsolutePathGo runs Basic Absolute path test +func TestCRDAanalyseWithAbsolutePathGo() { + When("I Test for analyse command with absolute path go", func() { + It("Should be able to get the absolute path", GetAbsPath) + It("I should Copy Manifest", CopyManifests) + It("I should be able to copy the main file", CopyManinfile) + It("I should able to run go mod tidy", RunGoModTidy) + It("Should be able to run analyse without error", RunAnalyseAbsolute) + It("I should Cleanup", Cleanup) + }) +} + +// GolangTestSuitePR tests golang on each PR +func GolangTestSuitePR() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/go.mod.template", "go") + }) + When("I test analyse command for Go with vulns", BasicTestGO) + When("I test analyse command for Go absolute path", TestCRDAanalyseWithAbsolutePathGo) + +} + +// GolangTestSuite works on the nightly test suite +func GolangTestSuite() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/go.mod.template", "go") + }) + When("I test analyse command for Go with vulns", BasicTestGO) + When("I test analyse command for Go absolute path", TestCRDAanalyseWithAbsolutePathGo) + When("I test analyse command for Go with vulns json", func() { + It("Should be able to get the absolute path", GetAbsPath) + It("I should Copy Manifest", CopyManifests) + It("I should be able to copy the main file", CopyManinfile) + It("I should able to run go mod tidy", RunGoModTidy) + It("I Should be able to run analyse without error", ValidateAnalseJSONVulns) + It("I should perform cleanup", Cleanup) + }) + When("I test analyse command for Go with vulns and verbose", func() { + It("Should be able to get the absolute path", GetAbsPath) + It("I should Copy Manifest", CopyManifests) + It("I should be able to copy the main file", CopyManinfile) + It("I should able to run go mod tidy", RunGoModTidy) + It("I Should be able to run analyse without error", ValidateAnalseVulnVerbose) + It("I should perform cleanup", Cleanup) + + }) + When("I test analyse command for Go with vulns and debug", func() { + It("Should be able to get the absolute path", GetAbsPath) + It("I should Copy Manifest", CopyManifests) + It("I should be able to copy the main file", CopyManinfile) + It("I should able to run go mod tidy", RunGoModTidy) + It("I Should be able to run analyse without error", ValidateAnalseVulnDebug) + It("I should perform cleanup", Cleanup) + + }) + When("I test analyse command for Go with vulns and all flags true", func() { + It("Should be able to get the absolute path", GetAbsPath) + It("I should Copy Manifest", CopyManifests) + It("I should be able to copy the main file", CopyManinfile) + It("I should able to run go mod tidy", RunGoModTidy) + It("I Should be able to run analyse without error", ValidateAnalseAllFlags) + It("I should perform cleanup", Cleanup) + }) + When("I test analyse command for Go without vulns", func() { + BeforeEach(func() { + GoMainFile = "/main2.go.template" + file, target = helper.CommonBeforeEach("/go2.mod.template", "go") + }) + It("Should be able to get the absolute path", GetAbsPath) + It("I should Copy Manifest", CopyManifests) + It("I should be able to copy the main file", CopyManinfile) + It("I should able to run go mod tidy", RunGoModTidy) + It("I Should be able to run analyse without error", ValidateAnalseNoVulns) + It("I should perform cleanup", Cleanup) + }) + When("I test analyse command for Go without vulns json", func() { + BeforeEach(func() { + GoMainFile = "/main2.go.template" + file, target = helper.CommonBeforeEach("/go2.mod.template", "go") + }) + It("Should be able to get the absolute path", GetAbsPath) + It("I should Copy Manifest", CopyManifests) + It("I should be able to copy the main file", CopyManinfile) + It("I should able to run go mod tidy", RunGoModTidy) + It("I Should be able to run analyse without error", ValidateAnalseJSONNoVulns) + It("I should perform cleanup", Cleanup) + }) +} diff --git a/acceptance-tests/tests/maven_tests.go b/acceptance-tests/tests/maven_tests.go new file mode 100644 index 0000000..fc38b57 --- /dev/null +++ b/acceptance-tests/tests/maven_tests.go @@ -0,0 +1,108 @@ +package tests + +import ( + "github.com/fabric8-analytics/cli-tools/acceptance-tests/helper" + . "github.com/onsi/ginkgo" +) + + +// BasicTestMaven tests Basic maven functionality +func BasicTestMaven() { + It("Copy Manifest", CopyManifests) + It("Should be able to run analyse without error", ValidateAnalseNoVulns) + It("I should perform cleanup", Cleanup) +} + +// BasicTestMavenVulns tests basic maven functionality with vulnerablities +func BasicTestMavenVulns() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/pom2.xml", "maven") + }) + It("Copy Manifest", CopyManifests) + It("Should be able to run analyse without error", ValidateAnalse) + It("I should perform cleanup", Cleanup) +} + +// TestCRDAanalyseWithAbsolutePathMvn tests with absolute path +func TestCRDAanalyseWithAbsolutePathMvn() { + When("I Test for analyse command with absolute path maven", func() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/pom2.xml", "maven") + }) + It("Should be able to get the absolute path", GetAbsPath) + It("Copy Manifest", CopyManifests) + It("Should be able to run analyse without error", RunAnalyseAbsolute) + It("I should Cleanup", Cleanup) + }) +} + +// MavenTestSuitePR runs on each PR +func MavenTestSuitePR() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/pom2.xml", "maven") + }) + When("I test analyse command for Maven with no vulns", BasicTestMaven) + When("I test analyse command for Maven with vulns", BasicTestMavenVulns) + When("I test analyse command for Maven absolute path", TestCRDAanalyseWithAbsolutePathMvn) + +} + +// MavenTestSuite runs on a nightly basis +func MavenTestSuite() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/pom.xml", "maven") + }) + When("I test analyse command for Maven with no vulns", BasicTestMaven) + When("I test analyse command for Maven with vulns", BasicTestMavenVulns) + When("I test analyse command for Maven absolute path", TestCRDAanalyseWithAbsolutePathMvn) + When("I test analyse command for Maven with no vulns json", func() { + It("Copy Manifest", CopyManifests) + It("Should be able to run analyse without error", ValidateAnalseJSONNoVulns) + It("I should perform cleanup", Cleanup) + }) + When("I test analyse command for Maven with vulns", func() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/pom2.xml", "maven") + }) + It("Copy Manifest", CopyManifests) + It("Should be able to run analyse without error", ValidateAnalse) + It("I should perform cleanup", Cleanup) + + }) + When("I test analyse command for Maven with vulns and json", func() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/pom2.xml", "maven") + }) + It("Copy Manifest", CopyManifests) + It("Should be able to run analyse without error", ValidateAnalseJSONVulns) + It("I should perform cleanup", Cleanup) + + }) + When("I test analyse command for Maven with vulns and verbose", func() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/pom2.xml", "maven") + }) + It("Copy Manifest", CopyManifests) + It("Should be able to run analyse without error", ValidateAnalseVulnVerbose) + It("I should perform cleanup", Cleanup) + + }) + When("I test analyse command for Maven with vulns and debug", func() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/pom2.xml", "maven") + }) + It("Copy Manifest", CopyManifests) + It("Should be able to run analyse without error", ValidateAnalseVulnDebug) + It("I should perform cleanup", Cleanup) + + }) + When("I test analyse command for Maven with vulns and all flags true", func() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/pom2.xml", "maven") + }) + It("Copy Manifest", CopyManifests) + It("Should be able to run analyse without error", ValidateAnalseAllFlags) + It("I should perform cleanup", Cleanup) + + }) +} diff --git a/acceptance-tests/tests/npm_tests.go b/acceptance-tests/tests/npm_tests.go new file mode 100644 index 0000000..f351481 --- /dev/null +++ b/acceptance-tests/tests/npm_tests.go @@ -0,0 +1,104 @@ +package tests + +import ( + "github.com/fabric8-analytics/cli-tools/acceptance-tests/helper" + . "github.com/onsi/ginkgo" + +) + +// NpmTestSuitePR runs on each PR check +func NpmTestSuitePR() { + + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/package.json", "npm") + }) + When("I test analyse for npm with vulns", TestCRDAanalyseNpm) + When("Test analyse with absolute path", TestCRDAanalyseWithAbsolutePathNpm) + +} + +// NpmTestSuite runs on a Nightly Check +func NpmTestSuite() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/package.json", "npm") + }) + When("I test analyse for npm with vulns", TestCRDAanalyseNpm) + When("I test analyse for npm with vulns with json", TestCRDAanalyseNpmJSON) + When("I test analyse for npm with vulns with verbose", TestCRDAanalyseNpmVerbose) + When("I test analyse for npm with vulns with debug", TestCRDAanalyseNpmDebug) + When("I test analyse for npm with vulns with all flags set true", TestCRDAanalyseNpmAllFlags) + When("I test analyse for npm without vulns with json", TestCRDAanalyseNpmJSONNoVulns) + When("Test analyse with absolute path", TestCRDAanalyseWithAbsolutePathNpm) + +} + +// TestCRDAanalyseNpm tests Basic npm functionality +func TestCRDAanalyseNpm() { + It("I should Copy Manifest", CopyManifests) + It("I should Install Dependencies to run Stack analyses", InstallNpmDeps) + It("I should Validate analyse for npm ecosystem", ValidateAnalse) + It("I should Cleanup", Cleanup) +} + +// TestCRDAanalyseNpmJSON tests functionality with json +func TestCRDAanalyseNpmJSON() { + It("I should Copy Manifest", CopyManifests) + It("I should Install Dependencies to run Stack analyses", InstallNpmDeps) + It("I should Validate analyse for npm ecosystem with vulns", ValidateAnalseJSONVulns) + It("I should Cleanup", Cleanup) +} + +// TestCRDAanalyseNpmJSONNoVulns tests functionality with json and no vulns +func TestCRDAanalyseNpmJSONNoVulns() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/vulns.json", "npm") + }) + It("I should Copy Manifest", CopyManifests) + It("I should Install Dependencies to run Stack analyses", InstallNpmDeps) + It("I should Validate analyse for npm ecosystem without vulns", ValidateAnalseJSONNoVulns) + It("I should Cleanup", Cleanup) +} + +// TestCRDAanalyseNpmVerbose tests functionality with verbose +func TestCRDAanalyseNpmVerbose() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/vulns.json", "npm") + }) + It("I should Copy Manifest", CopyManifests) + It("I should Install Dependencies to run Stack analyses", InstallNpmDeps) + It("I should Validate analyse for npm ecosystem with vulns verbose", ValidateAnalseVulnVerbose) + It("I should Cleanup", Cleanup) +} + +// TestCRDAanalyseNpmDebug tests functionality with debug +func TestCRDAanalyseNpmDebug() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/vulns.json", "npm") + }) + It("I should Copy Manifest", CopyManifests) + It("I should Install Dependencies to run Stack analyses", InstallNpmDeps) + It("I should Validate analyse for npm ecosystem with vulns with debug", ValidateAnalseVulnDebug) + It("I should Cleanup", Cleanup) +} + +// TestCRDAanalyseNpmAllFlags tests functionality with all flags set true +func TestCRDAanalyseNpmAllFlags() { + It("I should Copy Manifest", CopyManifests) + It("I should Install Dependencies to run Stack analyses", InstallNpmDeps) + It("I should Validate analyse for npm ecosystem with vulns and all flags set true", ValidateAnalseAllFlags) + It("I should Cleanup", Cleanup) +} + +// TestCRDAanalyseWithAbsolutePathNpm tests functionality with abs path +func TestCRDAanalyseWithAbsolutePathNpm() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/package.json", "npm") + }) + When("I Test for analyse command with absolute path npm", func() { + It("Should be able to get the absolute path", GetAbsPath) + It("I should Copy Manifest", CopyManifests) + It("I should Install Dependencies to run Stack analyses", InstallNpmDeps) + It("Should be able to run analyse without error", RunAnalyseAbsolute) + It("I should Cleanup", Cleanup) + }) +} diff --git a/acceptance-tests/tests/pypi_tests.go b/acceptance-tests/tests/pypi_tests.go new file mode 100644 index 0000000..510e8c9 --- /dev/null +++ b/acceptance-tests/tests/pypi_tests.go @@ -0,0 +1,90 @@ +package tests + +import ( + "github.com/fabric8-analytics/cli-tools/acceptance-tests/helper" + . "github.com/onsi/ginkgo" + +) + +// BasicTestPypi tests Basic functionality +func BasicTestPypi() { + It("I should Copy Manifest", CopyManifests) + It("I should able to run pip install", RunPipInstall) + It("I Should be able to run analyse without error", ValidateAnalse) + It("I should perform cleanup", Cleanup) + +} + +// TestCRDAanalyseWithAbsolutePathPypi tests functionality with abs path +func TestCRDAanalyseWithAbsolutePathPypi() { + When("I Test for analyse command with Absolute path pypi", func() { + It("I should Copy Manifest", CopyManifests) + It("I should able to run pip install", RunPipInstall) // While Running local replace the occurence of RunPipInstall with InitVirtualEnv func + It("Should be able to run analyse without error", RunAnalyseAbsolute) + It("I should Cleanup", Cleanup) + }) +} + +// PypiTestSuitePR runs on each PR check +func PypiTestSuitePR() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/requirements.txt", "pypi") + }) + When("I test analyse command for pypi with vulns", BasicTestPypi) + When("I test analyse command for pypi absolute path", TestCRDAanalyseWithAbsolutePathPypi) + +} + +// PypiTestSuite runs on a nightly basis +func PypiTestSuite() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/requirements.txt", "pypi") + }) + When("I test analyse command for pypi with vulns", BasicTestPypi) + When("I test analyse command for pypi absolute path", TestCRDAanalyseWithAbsolutePathPypi) + When("I test analyse command for pypi with vulns json", func() { + It("I should Copy Manifest", CopyManifests) + It("I should able to run pip install", RunPipInstall) + It("I Should be able to run analyse without error", ValidateAnalseJSONVulns) + It("I should perform cleanup", Cleanup) + }) + When("I test analyse command for pypi with vulns and verbose", func() { + It("I should Copy Manifest", CopyManifests) + It("I should able to run pip install", RunPipInstall) + It("I Should be able to run analyse without error", ValidateAnalseVulnVerbose) + It("I should perform cleanup", Cleanup) + + }) + When("I test analyse command for pypi with vulns and debug", func() { + It("I should Copy Manifest", CopyManifests) + It("I should able to run pip install", RunPipInstall) + It("I Should be able to run analyse without error", ValidateAnalseVulnDebug) + It("I should perform cleanup", Cleanup) + + }) + When("I test analyse command for pypi with vulns and all flags true", func() { + It("I should Copy Manifest", CopyManifests) + It("I should able to run pip install", RunPipInstall) + It("I Should be able to run analyse without error", ValidateAnalseAllFlags) + It("I should perform cleanup", Cleanup) + }) + When("I test analyse command for pypi without vulns", func() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/requirements2.txt", "pypi") + }) + It("I should Copy Manifest", CopyManifests) + It("I should able to run pip install", RunPipInstall) + It("I Should be able to run analyse without error", ValidateAnalseNoVulns) + It("I should perform cleanup", Cleanup) + }) + When("I test analyse command for pypi without vulns json", func() { + BeforeEach(func() { + file, target = helper.CommonBeforeEach("/requirements2.txt", "pypi") + }) + It("I should Copy Manifest", CopyManifests) + It("I should able to run pip install", RunPipInstall) + It("I Should be able to run analyse without error", ValidateAnalseJSONNoVulns) + It("I should perform cleanup", Cleanup) + }) + +} diff --git a/go.mod b/go.mod index 8d53605..7e41e4c 100644 --- a/go.mod +++ b/go.mod @@ -9,6 +9,8 @@ require ( github.com/jpillora/backoff v1.0.0 github.com/manifoldco/promptui v0.8.0 github.com/mitchellh/go-homedir v1.1.0 + github.com/onsi/ginkgo v1.16.1 + github.com/onsi/gomega v1.11.0 github.com/pborman/uuid v1.2.1 github.com/rs/zerolog v1.20.0 github.com/segmentio/analytics-go v3.0.1+incompatible diff --git a/go.sum b/go.sum index ea07f15..78d72ea 100644 --- a/go.sum +++ b/go.sum @@ -48,14 +48,16 @@ github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8 github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -66,10 +68,20 @@ github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFU github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= @@ -107,6 +119,7 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= @@ -156,7 +169,18 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.16.1 h1:foqVmeWDD6yYpK+Yz3fHyNIxFYNxswxqNFjSKe+vI54= +github.com/onsi/ginkgo v1.16.1/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.11.0 h1:+CqWgvj0OZycCaqclBD1pxKHAU+tOkHmQIWvDHq2aug= +github.com/onsi/gomega v1.11.0/go.mod h1:azGKhqFUon9Vuj0YmTfLSmx0FUwqXYSTl5re8lQLTUg= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw= github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= @@ -215,6 +239,7 @@ github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= @@ -250,18 +275,15 @@ golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTk golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 h1:2M3HP5CCK1Si9FQhwnzYhXdG6DXeebvUHFpre8QvbyI= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -274,7 +296,10 @@ golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -287,6 +312,7 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -298,15 +324,17 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091 h1:DMyOG0U+gKfu8JZzg2UQe9MeaC1X+xQWlAKcRnjxjCw= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -329,16 +357,13 @@ golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20190828213141-aed303cbaa74/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc h1:NCy3Ohtk6Iny5V/reW2Ktypo4zIpWBdRJ1uFMjBxdg8= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -361,18 +386,32 @@ google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvx google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=