Skip to content

Commit

Permalink
Merge pull request #25 from dragonchain/sc-test-bug-fixes
Browse files Browse the repository at this point in the history
Smart Contract test bug fixes
  • Loading branch information
anmil authored May 20, 2022
2 parents 9cb249f + a397c95 commit e207b4d
Show file tree
Hide file tree
Showing 6 changed files with 1,099 additions and 1,080 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 5.4.3

- **Feature:**
- Update dragonchain_mock_webserver docker image version
- **Bugs:**
- Path must not start with a slash or os.path.join will discard anything before it

## 5.4.1

- **Bugs:**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dctl",
"version": "5.4.2",
"version": "5.4.3",
"description": "Get your Dragonchain out of it's shell.",
"author": "Dragonchain, Inc. <[email protected]>",
"license": "Apache-2.0",
Expand Down
10 changes: 9 additions & 1 deletion src/dctl-contract-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,21 @@ program
const networkName = 'dragonchain-webserver';
const config = await getConfig(testRoot);
createDockerNetwork(networkName);

startWebserver(localEnv, networkName, localHeap);
await delay(1000); // Allow the server some time to start up

const contractRunShell = await runContract(image, payload, networkName, config.startCommand, localEnv, localSecrets);
await handleContractOutput(contractRunShell.stdout, localHeap);
}
})
.parse(process.argv);


function delay(time) {
return new Promise(resolve => setTimeout(resolve, time));
}

/**
* stringifyIfObject
* Stringify an object if we need to to match the output of python on dragonchain
Expand Down Expand Up @@ -132,7 +140,7 @@ function startWebserver(localEnv, networkName, localHeap) {
-l env=dragonchain_test_env \
-p 8080:8080 \
--env-file ${localEnv} \
docker.io/dragonchain/dragonchain_mock_webserver:0.0.2`;
docker.io/dragonchain/dragonchain_mock_webserver:0.0.3`;
shell.exec(command, { silent: true });
}
/**
Expand Down
3 changes: 1 addition & 2 deletions webserver/dragonchain/lib/smart_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@ def heap_get_v1(contract_id: str, path: str) -> str:
# Remove any potential extra '/' characters at the beginning of the string
while path.startswith("/"):
path = path[1:]
storage_key = f"/{path}"
return disk.get(key=storage_key).decode("utf-8")
return disk.get(key=path).decode("utf-8")
2 changes: 1 addition & 1 deletion webserver/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Flask==1.1.1
Flask==2.1.0
Loading

0 comments on commit e207b4d

Please sign in to comment.