Skip to content

Commit

Permalink
feat(daml): test tooling class
Browse files Browse the repository at this point in the history
Primary Changes
---------------
1. Create a test tooling class for DAML AIO Image
Fixes #3435

Signed-off-by: raynato.c.pedrajeta <raynato.c.pedrajeta@accenture.com>
  • Loading branch information
raynatopedrajeta committed Sep 16, 2024
1 parent 3172fc6 commit 28d84cd
Show file tree
Hide file tree
Showing 8 changed files with 6,505 additions and 10,890 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"Crpc",
"CSDE",
"csdetemplate",
"daml",
"data",
"davecgh",
"dclm",
Expand Down
98 changes: 98 additions & 0 deletions packages/cactus-plugin-ledger-connector-daml/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"name": "@hyperledger/cactus-plugin-ledger-connector-daml",
"version": "2.0.0-rc.4",
"description": "Allows Cactus nodes to connect to a DAML ledger.",
"keywords": [
"Hyperledger",
"Cactus",
"Integration",
"Blockchain",
"Distributed Ledger Technology"
],
"homepage": "https://github.com/hyperledger/cacti#readme",
"bugs": {
"url": "https://github.com/hyperledger/cacti/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/hyperledger/cacti.git"
},
"license": "Apache-2.0",
"author": {
"name": "Hyperledger Cactus Contributors",
"email": "cactus@lists.hyperledger.org",
"url": "https://www.hyperledger.org/use/cacti"
},
"contributors": [
{
"name": "Please add yourself to the list of contributors",
"email": "your.name@example.com",
"url": "https://example.com"
},
{
"name": "Peter Somogyvari",
"email": "peter.somogyvari@accenture.com",
"url": "https://accenture.com"
}
],
"main": "dist/lib/main/typescript/index.js",
"module": "dist/lib/main/typescript/index.js",
"browser": "dist/cactus-plugin-ledger-connector-daml.web.umd.js",
"types": "dist/lib/main/typescript/index.d.ts",
"files": [
"dist/*"
],
"scripts": {
"generate-sdk": "run-p 'generate-sdk:*'",
"generate-sdk:go": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g go -o ./src/main/go/generated/openapi/go-client/ --git-user-id hyperledger --git-repo-id $(echo $npm_package_name | replace @hyperledger/ \"\" -z)/src/main/go/generated/openapi/go-client --package-name $(echo $npm_package_name | replace @hyperledger/ \"\" -z) --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore",
"generate-sdk:kotlin": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g kotlin -o ./src/main/kotlin/generated/openapi/kotlin-client/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore",
"generate-sdk:typescript-axios": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --ignore-file-override ../../openapi-generator-ignore",
"generate-server": "yarn run --top-level openapi-generator-cli generate -i ./src/main/json/openapi.json -g kotlin-spring -o ./src/main-server/kotlin/gen/kotlin-spring/ -c ./src/main-server/openapi-generator-config.yaml --ignore-file-override ../../openapi-generator-ignore",
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js"
},
"dependencies": {
"@hyperledger/cactus-common": "2.0.0-rc.4",
"@hyperledger/cactus-core": "2.0.0-rc.4",
"@hyperledger/cactus-core-api": "2.0.0-rc.4",
"axios": "1.6.0",
"express-openapi-validator": "5.2.0",
"internal-ip": "6.2.0",
"joi": "17.13.3",
"node-ssh": "13.1.0",
"prom-client": "15.1.3",
"rxjs": "7.8.1",
"temp": "0.9.4",
"typescript-optional": "2.0.1"
},
"devDependencies": {
"@hyperledger/cactus-test-tooling": "2.0.0-rc.4",
"@types/body-parser": "1.19.4",
"@types/express": "4.17.21",
"@types/multer": "1.4.7",
"@types/temp": "0.9.1",
"@types/uuid": "10.0.0",
"body-parser": "1.20.2",
"express": "4.19.2",
"uuid": "10.0.0"
},
"engines": {
"node": ">=18",
"npm": ">=8"
},
"publishConfig": {
"access": "public"
},
"browserMinified": "dist/cactus-plugin-ledger-connector-daml.web.umd.min.js",
"mainMinified": "dist/cactus-plugin-ledger-connector-daml.node.umd.min.js",
"watch": {
"codegen:openapi": {
"patterns": [
"./src/main/json/openapi.json"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import "jest-extended";
import { DamlTestLedger } from "@hyperledger/cactus-test-tooling";

import {
LogLevelDesc,
LoggerProvider,
Logger,
} from "@hyperledger/cactus-common";
import { DAML_TEST_LEDGER_DEFAULT_OPTIONS } from "@hyperledger/cactus-test-tooling";
import { pruneDockerAllIfGithubAction } from "../../../../../../packages/cactus-test-tooling/src/main/typescript/github-actions/prune-docker-all-if-github-action";

const testLogLevel: LogLevelDesc = "info";

// Logger setup
const log: Logger = LoggerProvider.getOrCreate({
label: "daml-get-transaction.test",
level: testLogLevel,
});

describe("PluginLedgerConnectorDAML", () => {
let damlTestLedger: DamlTestLedger;

beforeAll(async () => {
log.info("Prune Docker...");
await pruneDockerAllIfGithubAction({ logLevel: testLogLevel });

damlTestLedger = new DamlTestLedger({
imageName: DAML_TEST_LEDGER_DEFAULT_OPTIONS.imageName,
imageVersion: DAML_TEST_LEDGER_DEFAULT_OPTIONS.imageVersion,
rpcApiHttpPort: DAML_TEST_LEDGER_DEFAULT_OPTIONS.rpcApiHttpPort,
});

log.debug("DAML image:", damlTestLedger.imageName);
expect(damlTestLedger).toBeTruthy();
await damlTestLedger.start();
});

afterAll(async () => {
log.info("FINISHING THE TESTS");
if (damlTestLedger) {
log.info("Stop the DAML ledger...");
await damlTestLedger.stop();
await damlTestLedger.destroy();
}

log.info("Prune Docker...");
await pruneDockerAllIfGithubAction({ logLevel: testLogLevel });
});

describe("daml test transaction", () => {
it("daml test transaction", async () => {
console.log("Initial run success");
});
});
});
Loading

0 comments on commit 28d84cd

Please sign in to comment.