Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@contract-app): fix contracts app tests #1982

Merged
merged 4 commits into from
Oct 23, 2019
Merged

Conversation

jrainville
Copy link
Collaborator

Fix for the contract app

@jrainville jrainville requested a review from a team October 22, 2019 19:08
@ghost
Copy link

ghost commented Oct 22, 2019

DeepCode Report (#e4ffae)

DeepCode analyzed this pull request.
There are no new issues.

@@ -30,7 +33,8 @@ contract("AnotherStorage", function() {
assert.equal(result.toString(), SimpleStorage.options.address);
});

it("set ENS address", async function() {
// FIXME add back when the ENS feature is back
xit("set ENS address", async function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is xit a typo?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's to disable the test. I did so because the ENS feature needs to be re-added to tests, but it's a whole different adventure that requires it's own PR

These changes don't fix the race conditions related to the test dapp's tests
but are a step in the right direction.
…sing

Further refactoring is needed re: potentially duplicated or overlapping logic
in `packages/plugins/solidity-tests` and
`packages/core/utils/src/solidity/remapImports.ts`, as well in disabled test
dapp tests
Copy link
Contributor

@0x-r4bbit 0x-r4bbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments inline.

There seem to be some changes in there that aren't clear as to why they are needed to make tests work again. Maybe you can add context/information?

deployIf: "await MyToken.methods.isAvailable().call()",
deployIf: (dependencies) => {
return dependencies.contract.MyToken.methods.isAvailable().call();
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we turn off string support in deployment hooks? I'm generally all for it, but I don't see a reference as to why this change here is needed otherwise.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's just that we thought we had a race condition between the execution of the deployIfs/onDeploys and the execution of the tests, so changing the hooks to functions should have fixed that.
Sadly, it didn't have the wanted effect, but at least, the function syntax is nicer

@@ -13,8 +13,11 @@ config({
"SimpleStorage": {
args: [100]
},
// "AnotherStorage": {
// args: ["$SimpleStorage", "embark.eth"]
// },
Copy link
Contributor

@0x-r4bbit 0x-r4bbit Oct 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is for the sake of keeping it around, this should probably be removed. Version control's got out back!

"AnotherStorage": {
args: ["$SimpleStorage", "embark.eth"]
args: ["$SimpleStorage", "$SimpleStorage"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks odd to me. Is injecting two SimpleStorage instances to AnotherStorage going to fix tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that's a patch, because support for .eth addresses is currently broken. We need to add back the module support feature, which is a big task, that will need to come in another PR.
In the meantime, I pass two times the same address just for the sake of not modifying the contract

@@ -12,6 +12,6 @@ contract OwnableTests {
}

function shouldnotbezeroAddress() public {
Assert.equal(true, true, "owner is uninitialized");
require(true == true, "owner is uninitialized");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we making this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had solidity errors because Assert. didn't exist.
We had forgotten that those are for the solidity tests. Eric reminded me yesterday. I'll need to revert and find why the remix tests don't work

michaelsbradleyjr and others added 2 commits October 23, 2019 09:50
They are failing because of a race condition; once that race condition has been
fixed these tests should be reenabled.
@iurimatias iurimatias merged commit 6e9635c into master Oct 23, 2019
@delete-merged-branch delete-merged-branch bot deleted the fix/all-test-apps branch October 23, 2019 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants