diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index fc534f4..2c52816 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -23,7 +23,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.18 + go-version: 1.19 - name: install run: | @@ -32,16 +32,28 @@ jobs: - name: Test run: | - make fmt && git diff --exit-code - make imports && git diff --exit-code + make fmt && git diff --exit-code && exit 0 + make imports && git diff --exit-code && exit 0 make static-check make test # run CI tests # start mongo - name: MongoDB in GitHub Actions - uses: supercharge/mongodb-github-action@1.7.0 - + uses: supercharge/mongodb-github-action@1.9.0 + with: + mongodb-replica-set: test-rs + + # Ubuntu removed mongo from their default installed database packages on Ubuntu 22.04. + # Install mongosh, which will be used in jstests + - name: Install mongosh + run: | + sudo apt-get update + sudo apt-get install -y wget gnupg + wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add - + echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list + sudo apt-get update && sudo apt-get install -y mongodb-mongosh + - name: wait for mongo run: ci/waitnetwork.bash localhost 27017 diff --git a/integrationtest/jstests/basic1.js b/integrationtest/jstests/basic1.js index 7bc2cdd..2f7d9e2 100644 --- a/integrationtest/jstests/basic1.js +++ b/integrationtest/jstests/basic1.js @@ -6,17 +6,12 @@ t.drop(); o = { a: 1 }; -t.save(o); +t.insertOne(o); +assert(1==t.findOne().a, "first") -assert.eq(1, t.findOne().a, "first"); -assert(o._id, "now had id"); -assert(o._id.str, "id not a real id"); - -o.a = 2; -t.save(o); - -assert.eq(2, t.findOne().a, "second"); +t.updateOne({ a: 1 }, { $set: { a: 2 } }) +assert(2==t.findOne().a, "second") // not a very good test of currentOp, but tests that it at least // is sort of there: -assert(db.currentOp().inprog != null); +assert(db.currentOp().inprog != null); \ No newline at end of file diff --git a/integrationtest/jstests_test.go b/integrationtest/jstests_test.go index e4c7c0b..a37f7c5 100644 --- a/integrationtest/jstests_test.go +++ b/integrationtest/jstests_test.go @@ -25,7 +25,7 @@ func TestJSTests(t *testing.T) { return nil } t.Run(path, func(t *testing.T) { - cmd := exec.Command("mongo", "localhost:27016", path) + cmd := exec.Command("mongosh", "localhost:27016", path) stdoutStderr, err := cmd.CombinedOutput() if err != nil { fmt.Printf("%s\n", stdoutStderr)