From d2b48b7e2ab70b44a9b1981e0b003871d311268b Mon Sep 17 00:00:00 2001 From: Sijie Date: Wed, 13 Mar 2024 12:46:00 -0700 Subject: [PATCH] update test.yml, var name, and mongo connection testing --- .github/workflows/test.yml | 8 -------- test/kbaseauthcontroller/authjars.go | 11 ----------- test/kbaseauthcontroller/controller.go | 5 +++++ test/mongocontroller/controller.go | 10 ++++++++-- 4 files changed, 13 insertions(+), 21 deletions(-) delete mode 100644 test/kbaseauthcontroller/authjars.go diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bcac2cd..829b409 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,14 +25,6 @@ jobs: mongo: 'mongodb-linux-x86_64-3.6.12' minio: '2019-05-23T00-29-34Z' wired_tiger: 'false' - - go: '1.12' - mongo: 'mongodb-linux-x86_64-3.6.20' - minio: '2019-05-23T00-29-34Z' - wired_tiger: 'true' - - go: '1.12' - mongo: 'mongodb-linux-x86_64-ubuntu2204-7.0.4' - minio: '2019-05-23T00-29-34Z' - wired_tiger: 'false' - go: '1.12' mongo: 'mongodb-linux-x86_64-ubuntu2204-7.0.4' minio: '2019-05-23T00-29-34Z' diff --git a/test/kbaseauthcontroller/authjars.go b/test/kbaseauthcontroller/authjars.go deleted file mode 100644 index 455684e..0000000 --- a/test/kbaseauthcontroller/authjars.go +++ /dev/null @@ -1,11 +0,0 @@ -package kbaseauthcontroller - -// this file simply lists the template and the jar in the KBase jars repo (https://github.com/kbase/jars) -// that are required to run the KBase auth server in test mode. -const ( - // authTemplates is the zip file containing templates for the server - authTemplates = "kbase/auth2/kbase-auth2templates-0.2.4.zip" - - // auth2ShadowAllJar is the jar required for the server - authShadowAllJar = "kbase/auth2/kbase-auth2-test-shadow-all-0.7.0.jar" -) diff --git a/test/kbaseauthcontroller/controller.go b/test/kbaseauthcontroller/controller.go index 2686158..bdd07be 100644 --- a/test/kbaseauthcontroller/controller.go +++ b/test/kbaseauthcontroller/controller.go @@ -22,8 +22,13 @@ import ( "github.com/phayes/freeport" ) +// The following are required to run the KBase auth server in test mode. const ( serverClass = "us.kbase.test.auth2.StandaloneAuthServer" + // authTemplates is the zip file containing templates for the server + authTemplates = "kbase/auth2/kbase-auth2templates-0.2.4.zip" + // auth2ShadowAllJar is the jar required for the server + authShadowAllJar = "kbase/auth2/kbase-auth2-test-shadow-all-0.7.0.jar" ) // Params are Parameters for creating a KBase Auth2 service (https://github.com/kbase/auth2) diff --git a/test/mongocontroller/controller.go b/test/mongocontroller/controller.go index 08e78f8..4156793 100644 --- a/test/mongocontroller/controller.go +++ b/test/mongocontroller/controller.go @@ -96,6 +96,12 @@ func New(p Params) (*Controller, error) { if err != nil { return nil, err } + + // test mongo connection + res := client.Database("foo").RunCommand(context.TODO(), map[string]int{"buildinfo": 1}) + if res.Err() != nil { + return nil, res.Err() + } // wired tiger will also not include index names for 3.0, but we're not going to test // that so screw it return &Controller{port, tdir, cmd, ver.LessThan(*semver.New("3.2.1000"))}, nil @@ -128,8 +134,8 @@ func (c *Controller) Destroy(deleteTempDir bool) error { return nil } -func getMongoDBVer(ExecutablePath string) (*semver.Version, error) { - cmd := exec.Command(ExecutablePath, "--version") +func getMongoDBVer(executablePath string) (*semver.Version, error) { + cmd := exec.Command(executablePath, "--version") stdout, err := cmd.Output() if err != nil { return nil, err