I have created a deployment script for an upgradable token contract which takes a flag from the command line for the deployment type.
I type...
truffle migrate --reset --type initial
truffle migrate --reset --type upgrade
truffle migrate --reset --type upgrade
if I type the commands in sequence, the upgrade succeeds every time for as many times as I need to.
But if any point after the initial deployment, I run...
truffle test --type initial
with or without following it with...
truffle test --type upgrade
it causes any further attempts to upgrade with...
truffle migrate --reset --type upgrade
to fail.
I thought the tests would be separated from my deployed contracts.
I asked chat GPT and it said to try adding the reset flag so I was able to do this...
truffle migrate --reset --type initial
truffle test --reset --type initial
truffle migrate --reset --type upgrade
truffle test --reset --type upgrade
but then when i run...
truffle migrate --reset --type upgrade
it fails, which suggests to me it was the test upgrade which caused it to fail
but I still don't know why