It took me awhile to diagnose the problem. At first I just noticed that the states of my contracts were being affected by previous tests when running
truffle test I then looked in the terminal tab in which I was running geth for my private network. I looked through the transactions and contract deployments and noticed that every time another test file begins execution all of my contracts are deployed again as expected. Then I realised that even after this all the transactions coming through from the tests were interacting with the first deployed contracts from the first test. All the contract instances returned by .deployed() in the second through last tests were referring to the contracts originally deployed in the in the first test. Below is a more simplified version of what I would see in the tab where I was running my geth node.
//executing test/first.js Submitted contract creation fullhash=0xTransactionHash0 contract=0xContractAddress0 Submitted contract creation fullhash=0xTransactionHash1 contract=0xContractAddress1 Submitted transaction fullhash=0xTransactionHash2 recipient=0xContractAddress1 //executing test/second.js Submitted contract creation fullhash=0xTransactionHash3 contract=0xContractAddress2 Submitted contract creation fullhash=0xTransactionHash4 contract=0xContractAddress3 Submitted transaction fullhash=0xTransactionHash5 recipient=0xContractAddress1
geth version => 1.9.12-stable
truffle version =>
Truffle v5.1.20 (core: 5.1.20)
Solidity v0.5.16 (solc-js)
Here is my startnode.sh file
geth --networkid 122349 --mine --minerthreads 2 --datadir "." --nodiscover --rpc --rpcport "8545" --port "30303" --rpccorsdomain "*" --nat "any" --rpcapi eth,web3,personal,net,debug --unlock 0 --password ./password.sec --ipcpath "~/.ethereum/geth.ipc" --allow-insecure-unlock --targetgaslimit '9000000'
I don't have this problem when I use ganache-cli this seems to be specific to geth. If any of you have any ideas as to what the cause of this error could be or and suggestions as to how I could potentially fix this I really apreciate them. Thank you all!