SNS local testing environment

So I’m still working through this:

but when I get to the swap participation section it says an invalid user amount

invalid_user_amount = null so this is not the root cause; instead error_type = 2 suggests that the swap is closed already. Although the README says that you could run participate_sns_swap.sh multiple times, the script would fail once the total staked amount reaches the maximum.

So I run the cleanup and try to redeploy the test canister

but it says it is unable to read test.wasm but I have updated the deploy_test_canister.sh script in sns-testing to the following:

Not sure why it is referencing test.

Thanks
James

1 Like

Keep it up Champs, we are getting the slowly but surely.

I’m not sure either. Could you please make sure that the files didn’t change behind the scenes since you last edited them (e.g., using cat ...)? Next, you could try echo ... the individual env variables in the deploy_dapp.sh script to see why they’re equal to test.

Does this dfx.json in the sns-testing repo need to be updated:

What is a good file to print the variables in?

Could you please cat the file deploy_test_canister.sh within docker?

Yes, you should add your canister to it if you use the deploy_dapp.sh script.

I’m not sure where it needs to be set as it looks like it should be automatic. I’ve pushed the sns-testing repo I’m working in here.

I ran it from the beginning from setting up locally and running the basic scenario without issue:

I then ran cleanup.sh and then tried to deploy the test canister in the repo but get this error:

If you could tell me which file I need to log / update that would be great.

First, the cleanup.sh script is only supposed to be run before re-running the sns-testing flow from scratch in the same directory again (as the script will delete all sorts of artifacts incl. sns canister configuration), i.e., the clean-up is not supposed to be run during a single sns-testing flow.

But this doesn’t really explain what you see: in fact, you’re running the deploy_test_canister.sh from the home directory ~ of the docker container which contains the official sns-testing scripts coming with the dfinity/sns-testing repository. Your local changes are only available under /dapp and must be used from there:

~# cd /dapp
~# ./deploy_test_canister.sh

Note that

echo cat Name

won’t print the env variable Name: to this end, you should use

echo $Name

So even when I’m in my dapps folder it’s trying to create a test canister and not my backend:

So even when I’m in my dapps folder

you’re only in your dapps folder in the outer shell; the docker container is in its home directory (see ~#) and this home directory contains the official scripts without your local changes

Ok so how do I get the required script in the created dapp folder?

You need to run

SNS_TESTING_INSTANCE=$(
   docker run -p 8000:8000 -p 8080:8080 -v "`pwd`":/dapp -d ghcr.io/dfinity/sns-testing:main dfx start --clean
)

from within the root directory of your dapp project.

Ok so I did it all again in the project folder:

But the file isn’t created in the dapp folder:

And deploying from the bash ~ folder just deploys the test canister

But the file isn’t created in the dapp folder:

It won’t be created automatically - you need to manually copy it there incl. its dependencies such as deploy_dapp.sh

Ok so I copied the files into the directory and ran deploy_test_canister.sh:

But the environment variables are not set I guess, is there a step between starting the bash shell and running the test with my apps backend canister?

if you copy all your (potentially modified) sns-testing content into your project’s directory, then it’d work

Ok so I tried copying all the files, and it tried to run the script but I’m back to these errors:

It’s also trying to deploy a test canister which isn’t specific to OpenFPL…