Skip to content

Commit

Permalink
Bump ipfs test docker image and fix circular imports in tests (#2025)
Browse files Browse the repository at this point in the history
* bump ipfs test image

* remove unused tests anad fix circular imports
  • Loading branch information
pablomendezroyo authored Sep 9, 2024
1 parent 081c80c commit c51e0a5
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 66 deletions.
6 changes: 3 additions & 3 deletions packages/dappmanager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"build": "tsc -p tsconfig.json",
"watch-ts": "tsc -w",
"file": "node",
"test": "npm run test:file \"./{,!(node_modules)/**}/*.test.ts\" ",
"test": "yarn run test:file \"./{,!(node_modules)/**}/*.test.ts\" ",
"test:file": "TEST=true mocha",
"test:int": "npm run test:int:file \"./{,!(node_modules)/**}/*.test.int.ts\" ",
"test:int": "yarn run test:int:file \"./{,!(node_modules)/**}/*.test.int.ts\" ",
"test:int:file": "HTTP_API_PORT=5000 TEST=true mocha --config ./test/integration/.mocharc.yaml --timeout 180000",
"test:all": "npm run test && npm run test:int",
"test:all": "yarn run test && yarn run test:int",
"clean": "rm -rf DNCORE/ dnp_repo/ .temp-transfer/ cache/ dist/"
},
"license": "GPL-3.0",
Expand Down

This file was deleted.

35 changes: 22 additions & 13 deletions packages/dappmanager/test/integration/fetchSystemData.test.int.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import "mocha";
import { expect } from "chai";
import * as calls from "../../src/calls/index.js";
import { autoUpdateSettingsEdit } from "../../src/calls/autoUpdateSettingsEdit.js";
import { autoUpdateDataGet } from "../../src/calls/autoUpdateDataGet.js";
import { statsDiskGet } from "../../src/calls/statsDiskGet.js";
import { statsMemoryGet } from "../../src/calls/statsMemoryGet.js";
import { statsCpuGet } from "../../src/calls/statsCpuGet.js";
import { systemInfoGet } from "../../src/calls/systemInfoGet.js";
import { getUserActionLogs } from "../../src/calls/getUserActionLogs.js";
import { notificationsTest } from "../../src/calls/notificationsTest.js";
import { notificationsGet } from "../../src/calls/notificationsGet.js";
import { notificationsRemove } from "../../src/calls/notificationsRemove.js";
import { logs } from "@dappnode/logger";
import { AutoUpdateSettings } from "@dappnode/types";
import { MY_PACKAGES, SYSTEM_PACKAGES } from "@dappnode/daemons";
Expand All @@ -14,16 +23,16 @@ describe("Auto update data", () => {
const enabled = true;

it("Should edit auto-update data", async () => {
await calls.autoUpdateSettingsEdit({ id: MY_PACKAGES, enabled });
await calls.autoUpdateSettingsEdit({ id: SYSTEM_PACKAGES, enabled });
await autoUpdateSettingsEdit({ id: MY_PACKAGES, enabled });
await autoUpdateSettingsEdit({ id: SYSTEM_PACKAGES, enabled });
});

it("Should retrieve modified auto-update data", async () => {
const expectedSettings: AutoUpdateSettings = {
[MY_PACKAGES]: { enabled },
[SYSTEM_PACKAGES]: { enabled }
};
const { settings } = await calls.autoUpdateDataGet();
const { settings } = await autoUpdateDataGet();
expect(settings).to.deep.equal(expectedSettings);
});
});
Expand All @@ -34,27 +43,27 @@ describe("Get system data", () => {
});

it("Should return parsed disk stats from host machine", async () => {
const result = await calls.statsDiskGet();
const result = await statsDiskGet();
expect(result).to.be.ok;
}).timeout(10 * 1000);

it("Should return parsed memory stats from host machine", async () => {
const result = await calls.statsMemoryGet();
const result = await statsMemoryGet();
expect(result).to.be.ok;
}).timeout(10 * 1000);

it("Should return parsed CPU stats from host machine", async () => {
const result = await calls.statsCpuGet();
const result = await statsCpuGet();
expect(result).to.be.ok;
}).timeout(10 * 1000);

it("Should get DAPPMANAGER system info", async () => {
await calls.systemInfoGet();
await systemInfoGet();
// Can't check return because is only exists on full build :(
}).timeout(10 * 1000);

it("Should getUserActionLogs", async () => {
const result = await calls.getUserActionLogs({});
const result = await getUserActionLogs({});
// User logs should be empty since nothing happened that was registered
expect(result).to.be.a("array");
});
Expand All @@ -66,21 +75,21 @@ describe("Get system data", () => {
describe.skip("Notifications", async () => {
before("Should post a test notification", async () => {
clearDbs();
await calls.notificationsTest({});
await notificationsTest({});
});

let id: string;

it("Should retrieve notifications", async () => {
const result = await calls.notificationsGet();
const result = await notificationsGet();
expect(result).to.have.length.greaterThan(0, "There should be one notification");
id = result[0].id;
});

it("Should remove a notification", async () => {
if (!id) throw Error("Previous test failed");
await calls.notificationsRemove({ ids: [id] });
const result = await calls.notificationsGet();
await notificationsRemove({ ids: [id] });
const result = await notificationsGet();
const deletedNotification = result.find((n) => n.id === id);
if (deletedNotification) {
logs.info("deletedNotification", result);
Expand Down
2 changes: 1 addition & 1 deletion packages/dappmanager/test/integration/testIpfsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const localIpfsGateway = create({
export async function setUpIpfsNode(): Promise<void> {
// Startup ipfs container
await shell(
`docker run --rm -d --name ${ipfsTestContainerName} -p 127.0.0.1:8080:8080 -p 127.0.0.1:5001:5001 ipfs/go-ipfs:v0.19.2`
`docker run --rm -d --name ${ipfsTestContainerName} -p 127.0.0.1:8080:8080 -p 127.0.0.1:5001:5001 ipfs/kubo:v0.29.0`
);

// Wait until ipfs is available
Expand Down
4 changes: 2 additions & 2 deletions packages/dappmanager/test/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import {
PackageRelease,
ReleaseSignatureStatusCode,
InstallPackageData,
Compose
Compose,
Manifest
} from "@dappnode/types";
import { Manifest } from "@dappnode/types";
import { DappnodeInstaller } from "@dappnode/installer";
import { ethers } from "ethers";

Expand Down

0 comments on commit c51e0a5

Please sign in to comment.