diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0295a45..7f5bb62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,24 +36,9 @@ jobs: node-version: ${{ matrix.node }} cache: npm - # ocean.js#2216 build; remove with the link step after its release - - name: Checkout ocean.js - uses: actions/checkout@v7 - with: - persist-credentials: false - repository: 'oceanprotocol/ocean.js' - ref: 'rc_11.0.0' - path: 'ocean.js' - - name: Build and link ocean.js - working-directory: ${{ github.workspace }}/ocean.js - run: npm ci && npm run build && npm link - - name: Install dependencies run: npm ci - - name: Use the ocean.js build - run: npm link @oceanprotocol/lib - - name: Run build run: npm run build @@ -201,22 +186,10 @@ jobs: working-directory: ${{ github.workspace }}/barge run: | bash -x start_ocean.sh --with-typesense 2>&1 > start_ocean.log & - # ocean.js#2216 build; remove with the link step after its release - - name: Checkout ocean.js - uses: actions/checkout@v7 - with: - persist-credentials: false - repository: 'oceanprotocol/ocean.js' - ref: 'rc_11.0.0' - path: 'ocean.js' - - name: Build and link ocean.js - working-directory: ${{ github.workspace }}/ocean.js - run: npm ci && npm run build && npm link - + env: + NODE_VERSION: pr-1641 - name: Install dependencies run: npm ci - - name: Use the ocean.js build - run: npm link @oceanprotocol/lib - run: npm run build - run: docker image ls diff --git a/package-lock.json b/package-lock.json index b700113..0b78eee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1936,6 +1936,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/@oceanprotocol/ddo-js/-/ddo-js-1.1.0.tgz", "integrity": "sha512-9/CYpaD0qzA/smmK63nMDnnd3XYNGGreb8y7uUwiC6ODqEKyvhEdMnSj2Rya4oNpyiJQ9cJhOsNGSEmYDhynKw==", + "license": "Apache-2.0", "dependencies": { "ethers": "^6.17.0", "jsonld": "^9.0.0", @@ -3102,6 +3103,7 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==", + "deprecated": "Active development of CryptoJS has been discontinued. This library is no longer maintained.", "license": "MIT" }, "node_modules/datastore-core": { @@ -4943,6 +4945,7 @@ "version": "2.13.12", "resolved": "https://registry.npmjs.org/n3/-/n3-2.13.12.tgz", "integrity": "sha512-z944NsyJi58WXcYevtNkUL2JhVr0KP6nvED9AgymQq5V35TDaNn1N8kO+OWJk/kj4PR0L/ilWB3d7/bWceg1CQ==", + "license": "MIT", "dependencies": { "buffer": "^6.0.3", "readable-stream": "^4.0.0" diff --git a/test/http.test.ts b/test/http.test.ts index 1fd6172..e92adb7 100644 --- a/test/http.test.ts +++ b/test/http.test.ts @@ -1,18 +1,41 @@ import { expect } from "chai"; +import { ProviderInstance } from "@oceanprotocol/lib"; -describe("Ocean Node Root Endpoint", () => { - it("should return 200 OK", async () => { - const response = await fetch("http://localhost:8001/"); - const responseBody = await response.json(); +// Node status is fetched through ocean.js `getNodeStatus` (which uses the STATUS +// command over `POST /directCommand`), not a raw `fetch` to the root endpoint, so +// this is immune to the ocean-node #1622 root-endpoint rename (`nodeId`/ +// `providerAddress`/`nodePublicKey`/`software` are gone; the status object exposes +// `id`/`address`/`publicKey`). It runs over the node's HTTP API, which is up in +// both CI transport legs; the P2P transport itself is exercised by the full +// system-test suite (which runs the CLI with NODE_URL set to the node's peer id). +const NODE_HTTP = "http://127.0.0.1:8001"; - expect(response.status).to.equal(200); - expect(responseBody).to.have.property("id"); - expect(responseBody).to.have.property("address"); - expect(responseBody).to.have.property("provider"); - expect(responseBody).to.have.property("version"); +describe("Ocean Node status (via getNodeStatus)", function () { + this.timeout(30_000); + + it("should return the full node status object", async () => { + const status = await ProviderInstance.getNodeStatus( + NODE_HTTP, + AbortSignal.timeout(15_000), + ); + + expect(status, `node ${NODE_HTTP} should be reachable`).to.not.be.null; + expect(status).to.have.property("id"); + expect(status).to.have.property("publicKey"); + expect(status).to.have.property("address"); + expect(status).to.have.property("version"); + expect(status).to.have.property("http"); + expect(status).to.have.property("p2p"); + expect(status).to.have.property("provider"); + expect(status).to.have.property("indexer"); + expect(status).to.have.property("supportedStorage"); + expect(status).to.have.property("uptime"); + expect(status).to.have.property("platform"); + expect(status).to.have.property("codeHash"); + expect(status).to.have.property("allowedAdmins"); // Check if version is "0.0.1" or greater - const [major, minor, patch] = responseBody.version.split(".").map(Number); + const [major, minor, patch] = status.version.split(".").map(Number); expect(major).to.be.at.least(0); if (major === 0) { expect(minor).to.be.at.least(0); @@ -23,38 +46,6 @@ describe("Ocean Node Root Endpoint", () => { }); }); -describe("Direct Command Endpoint", () => { - it("should return correct status", async () => { - const response = await fetch("http://localhost:8001/directCommand", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ command: "status" }), - }); - const responseBody = await response.json(); - - expect(response.status).to.equal(200); - expect(responseBody).to.have.property("id"); - expect(responseBody).to.have.property("publicKey"); - expect(responseBody).to.have.property("address"); - expect(responseBody).to.have.property("version"); - expect(responseBody).to.have.property("http"); - expect(responseBody).to.have.property("p2p"); - expect(responseBody).to.have.property("provider"); - expect(responseBody).to.have.property("indexer"); - expect(responseBody).to.have.property("supportedStorage"); - expect(responseBody).to.have.property("uptime"); - expect(responseBody).to.have.property("platform"); - expect(responseBody).to.have.property("codeHash"); - expect(responseBody).to.have.property("allowedAdmins"); - - // Check the values of some of the properties - expect(responseBody.http).to.be.true; - expect(responseBody.p2p).to.be.true; - }); -}); - describe("getP2PPeers Endpoint", () => { it("should return correct status", async () => { const response = await fetch("http://localhost:8001/getP2PPeers");