Now that there exists commits to 2 different branches, there needs to be a rollback handler to cater for the case of network failures that exist for a commit to 1 branch. else, we might have a scary situation whereby staging-lite updates, but staging doesnt, and this leads to a wrongly output production site. this effectively means that there should be any use of the writeroutehandler since any write can lead to deviation of staging and staging lite
Note that we dont need to do any thing with regards checking if a site is whitelisted for quickie since all sites have the staging lite branch infra already set up. the whitelisting only dictates whether or not the staging lite file gets updated or not.
Previously, we were not using the rollback properly, this pr converts the file to ts to allow for easier type checking.
there were also some weird errors that occured that could be avoided with the retry. however, staging lite needs to be pushed with a .push(gitOptions), which the retry mechanism does not have. as a bandage, retry twice with the options, check in with @harishv7 on why there exists a retry in GitFileSystemService in the first place.
Manual tests for rollback handler
[Testing for quickie whitelisted site that is GGs]
[ ] use a email login site, ensure that that it is whitelisted for build time reduction in growthbook
[ ] create a file, ensure that no error are obsevered
[ ] go into the create function of GitFileSystemService and short circuit the function by adding a early // return errAsync(new ConflictError("this is a test failure")) eg.
create(
repoName: string,
userId: string,
content: string,
directoryName: string,
fileName: string,
encoding: "utf-8" | "base64" = "utf-8",
branchName: string
): ResultAsync<
GitCommitResult,
ConflictError | GitFileSystemError | NotFoundError
> {
// short circuit for testing
return errAsync(new ConflictError("this is a test failure"))
... // rest of code
}
[ ] re-run the create operation, notice that all rollbacks occur for both staging + staging-lite.
[Testing for non-quickie whitelisted site that is GGs]
[ ] do the same as above but not quickie should not be whitelisted
[Testing for GH sites for rollback handler] (all gh sites are NOT whitelisted for quickie)
[ ] throw error in the create function for GithubService
[ ] notice that rollback works as intended -> it goes back to the last known state sucessfully.
[Testing normal crud operations]
Tests
In staging environment,
kishore-test is quickie + zhongjun-test-amplify is NON-quickie + kishore-test-dev-gh on github (non qucikie)
Now that there exists commits to 2 different branches, there needs to be a rollback handler to cater for the case of network failures that exist for a commit to 1 branch. else, we might have a scary situation whereby staging-lite updates, but staging doesnt, and this leads to a wrongly output production site. this effectively means that there should be any use of the
writeroutehandler
since any write can lead to deviation of staging and staging liteNote that we dont need to do any thing with regards checking if a site is whitelisted for quickie since all sites have the staging lite branch infra already set up. the whitelisting only dictates whether or not the staging lite file gets updated or not.
Previously, we were not using the rollback properly, this pr converts the file to ts to allow for easier type checking. there were also some weird errors that occured that could be avoided with the retry. however, staging lite needs to be pushed with a
.push(gitOptions)
, which the retry mechanism does not have. as a bandage, retry twice with the options, check in with @harishv7 on why there exists a retry inGitFileSystemService
in the first place.Manual tests for rollback handler
[Testing for quickie whitelisted site that is GGs]
create
function ofGitFileSystemService
and short circuit the function by adding a early// return errAsync(new ConflictError("this is a test failure"))
eg.[Testing for non-quickie whitelisted site that is GGs]
[Testing for GH sites for rollback handler] (all gh sites are NOT whitelisted for quickie)
GithubService
[Testing normal crud operations]
Tests
In staging environment,
kishore-test
is quickie +zhongjun-test-amplify
is NON-quickie +kishore-test-dev-gh
on github (non qucikie)