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

add resolver skylink download to critical checks #13

Merged
merged 2 commits into from
Jun 27, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/checks/critical.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ const MODULE_BLOCKER = "b";
const skynetClient = new SkynetClient(`https://${process.env.PORTAL_DOMAIN}`);
const exampleSkylink = "AACogzrAimYPG42tDOKhS3lXZD8YvlF8Q8R17afe95iV2Q";

// this resolver skylink points to latest release of webportal-website and
// is updated automatically on each merged pull request via github-actions
// source: https://github.com/SkynetLabs/webportal-website
const exampleResolverSkylink = "AQCExZYFmmc75OPgjPpHuF4WVN0pc4FX2p09t4naLKfTLw";

// check that any relevant configuration is properly set in skyd
async function skydConfigCheck(done) {
const time = process.hrtime();
Expand Down Expand Up @@ -69,12 +74,19 @@ async function websiteCheck(done) {
}

// downloadCheck returns the result of downloading the hard coded link
kwypchlo marked this conversation as resolved.
Show resolved Hide resolved
async function downloadCheck(done) {
async function downloadSkylinkCheck(done) {
kwypchlo marked this conversation as resolved.
Show resolved Hide resolved
const url = await skynetClient.getSkylinkUrl(exampleSkylink);

return done(await genericAccessCheck("skylink", url));
}

// downloadResolverSkylinkCheck returns the result of downloading an example resolver skylink
async function downloadResolverSkylinkCheck(done) {
const url = await skynetClient.getSkylinkUrl(exampleResolverSkylink);

return done(await genericAccessCheck("resolver_skylink", url));
}

// skylinkSubdomainCheck returns the result of downloading the hard coded link via subdomain
async function skylinkSubdomainCheck(done) {
const url = await skynetClient.getSkylinkUrl(exampleSkylink, { subdomain: true });
Expand Down Expand Up @@ -221,7 +233,8 @@ const checks = [
skydConfigCheck,
uploadCheck,
websiteCheck,
downloadCheck,
downloadSkylinkCheck,
downloadResolverSkylinkCheck,
skylinkSubdomainCheck,
handshakeSubdomainCheck,
registryWriteAndReadCheck,
Expand Down