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

post_upgrade tests #1497

Open
4 tasks
Tracked by #1391
dansteren opened this issue Dec 12, 2023 · 0 comments
Open
4 tasks
Tracked by #1391

post_upgrade tests #1497

dansteren opened this issue Dec 12, 2023 · 0 comments
Assignees
Milestone

Comments

@dansteren
Copy link
Contributor

dansteren commented Dec 12, 2023

The generated canister will look something like this:

// Create variables for each post_upgrade param
let initialized: boolean = false;
let deployParam0: any;
let deployParam1: any;

export default Canister {
    init: ([bool, text], (param0, param1) => {
        ensureParamsCorrectlyOrdered(param0, param1);
        deployParam0 = param0;
        deployParam1 = param1;
    }),
    postUpgrade: ([bool, text], (param0, param1) => {
        ensureParamsCorrectlyOrdered(params, param1);
        deployParam0 = param0;
        deployParam1 = param1;
    }),

    // create a method to retrieve the stored values
    getDeployParams: query([], Tuple(bool, bool,text), () => {
        return [initialized, initParam0, initParam1]
    })
}

Subtasks

  • Ensure init and post-upgrade params are the same types
  • Pass different values for init and postDeploy (maybe?)
  • Support 0 parameters
  • have multiple deploys in the tests with different postUpgrade params for each.
@dansteren dansteren self-assigned this Dec 12, 2023
@dansteren dansteren linked a pull request Dec 29, 2023 that will close this issue
@lastmjs lastmjs added this to the 1.0 milestone Jan 5, 2025
@lastmjs lastmjs changed the title post_upgrade post_upgrade tests Jan 10, 2025
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 a pull request may close this issue.

2 participants