Skip to content

Commit

Permalink
Attempt at making tests stable
Browse files Browse the repository at this point in the history
  • Loading branch information
shahthepro committed Jun 7, 2024
1 parent 3595c6d commit 31548d1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
7 changes: 5 additions & 2 deletions script/deploy/DeployManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ contract DeployManager is Script {

constructor() {
isForked = vm.isContext(VmSafe.ForgeContext.ScriptDryRun) || vm.isContext(VmSafe.ForgeContext.TestGroup);
forkFileId = Strings.toString(block.timestamp);
}

function getDeploymentFilePath() public view returns (string memory) {
Expand All @@ -38,9 +39,11 @@ contract DeployManager is Script {
return string(abi.encodePacked(vm.projectRoot(), "/build/deployments-fork", forkFileId, ".json"));
}

function setUp() external {
forkFileId = Strings.toString(block.timestamp);
function setForkFileId(string memory _forkFileId) external {
forkFileId = _forkFileId;
}

function setUp() external {
string memory chainIdStr = Strings.toString(block.chainid);
string memory chainIdKey = string(abi.encodePacked(".", chainIdStr));

Expand Down
2 changes: 2 additions & 0 deletions tests/staking/MigratorForkTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ contract MigratorForkTest is Test {
constructor() {
deployManager = new DeployManager();

deployManager.setForkFileId(string(abi.encodePacked(vm.toString(block.chainid), "-MigratorForkTest")));

deployManager.setUp();
deployManager.run();
}
Expand Down
2 changes: 2 additions & 0 deletions tests/staking/OGNRewardsSourceForkTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ contract OGNRewardsSourceForkTest is Test {
constructor() {
deployManager = new DeployManager();

deployManager.setForkFileId(string(abi.encodePacked(vm.toString(block.chainid), "-OGNRewardsSourceForkTest")));

deployManager.setUp();
deployManager.run();
}
Expand Down
2 changes: 2 additions & 0 deletions tests/staking/XOGNStakingForkTest.t..sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ contract XOGNStakingForkTest is Test {
constructor() {
deployManager = new DeployManager();

deployManager.setForkFileId(string(abi.encodePacked(vm.toString(block.chainid), "-XOGNStakingForkTest")));

deployManager.setUp();
deployManager.run();
}
Expand Down
2 changes: 2 additions & 0 deletions tests/staking/ZapperForkTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ contract ZapperForkTest is Test {
constructor() {
deployManager = new DeployManager();

deployManager.setForkFileId(string(abi.encodePacked(vm.toString(block.chainid), "-ZapperForkTest")));

deployManager.setUp();
deployManager.run();
}
Expand Down

0 comments on commit 31548d1

Please sign in to comment.