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(test): test nearlib key path #2885

Merged
merged 8 commits into from
Jun 25, 2020
Merged

Conversation

ailisp
Copy link
Member

@ailisp ailisp commented Jun 23, 2020

This Fix #2580, and also eliminate warnings appears in near-api-js about validator_key.json

Test Plan

test_nearlib.sh should work both locally and on CI

@gitpod-io
Copy link

gitpod-io bot commented Jun 23, 2020

@ailisp ailisp requested a review from vgrichina June 23, 2020 22:14
@vgrichina
Copy link
Collaborator

@ailisp is error you are getting related to https://discordapp.com/channels/490367152054992913/557983089704566787/725088894466523258 ?

@ailisp
Copy link
Member Author

ailisp commented Jun 23, 2020

I think yes 👍

@ailisp
Copy link
Member Author

ailisp commented Jun 23, 2020

@vgrichina pass after Bowen's fix. ptal

scripts/test_nearlib.sh Outdated Show resolved Hide resolved
@@ -16,19 +16,23 @@ git clone https://github.com/near/create-near-app.git
# Make sure to use local nearcore for tests
export NODE_ENV=local

SRC_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
export HOME=$SRC_DIR/../testdir
Copy link
Collaborator

Choose a reason for hiding this comment

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

it's a bit concerning we have to override HOME. Why? Shouldn't it be possible to pass NEAR home dir explicitly to start_unittest.py (same as you can specify it explicitly with nearup)?

Copy link
Member Author

Choose a reason for hiding this comment

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

both create-near-app and near-api-js (when NODE_ENV is local) assume validator_key.json is at process.env.HOME/.near/validator_key.json so this has to be overrided. It's fine to override home even when run locally, because it only in the sub-shell, won't affect HOME after script exit

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe should fix in near-api-js and create-near-app side:
https://github.com/near/near-api-js/blob/master/test/config.js#L38
https://github.com/near/create-near-app/blob/master/blank_react_project/src/config.js#L44

But i think it's okay to override $HOME as it's only used in nearcore integration test, not worthy to not hard code in near-api-js/create-near-app

Copy link
Collaborator

Choose a reason for hiding this comment

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

@ailisp what is default path when I run local nearcore instance? Is it process.env.HOME/.near/validator_key.json? Or did it change? I think it did change for nearup, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes nearup change it to be HOME/.near/localnet/validator_key.json, however the test here isn't using, maybe i should replace it using nearup localnet.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Created separate issue to track local dev env fixes:
near/devx#221

scripts/test_nearlib.sh Outdated Show resolved Hide resolved
Copy link
Collaborator

@vgrichina vgrichina left a comment

Choose a reason for hiding this comment

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

see comments


# Run near-shell tests
Copy link
Collaborator

Choose a reason for hiding this comment

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

@ailisp do you plan to enable these in follow up PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

This still fails of missing masterAccount param, will fix later

@nearprotocol-bulldozer nearprotocol-bulldozer bot merged commit df5217c into master Jun 25, 2020
@nearprotocol-bulldozer nearprotocol-bulldozer bot deleted the fix-nearlib-test branch June 25, 2020 17:16
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.

Re-enable create-near-app tests on CI
2 participants