Update to import json from testing-corpus

This commit is contained in:
Matthew Sevey 2021-11-24 15:03:11 -05:00
parent 8996bab1b5
commit b21ee611a0
No known key found for this signature in database
GPG Key ID: 9ADDD344F13057F6
6 changed files with 10 additions and 1513 deletions

View File

@ -1,39 +0,0 @@
name: Update Test Data
on:
schedule:
# Run job hourly
- cron: '0 * * * *'
jobs:
update-test-data:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Helper for grabbing the branch name
- uses: nelonoel/branch-name@v1.0.1
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: 16.x
# Install node modules for updatetestdata.js script
- name: Install Dependencies
run: |
npm install got
npm install prettier
# Generate the new test data for the Health Checks
- name: Generate test data
run: |
node packages/health-check/src/updatetestdata.js > packages/health-check/src/fixtures/testdata.json
npx prettier --write packages/health-check/src/fixtures/testdata.json
# Commit the Updates to the test data
- name: Update test data
uses: test-room-7/action-update-file@v1
with:
file-path: packages/health-check/src/fixtures/testdata.json
commit-msg: Update testdata from Github Actions
branch: ${{ env.BRANCH_NAME }}
github-token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -14,6 +14,7 @@
"lodash": "^4.17.21",
"lowdb": "^1.0.0",
"skynet-js": "^3.0.2",
"testing-corpus": "https://github.com/SkynetLabs/testing-corpus",
"write-file-atomic": "^3.0.3",
"yargs": "^17.2.1"
},

View File

@ -4,15 +4,13 @@ const { detailedDiff } = require("deep-object-diff");
const { isEqual } = require("lodash");
const { calculateElapsedTime, ensureValidJSON, getResponseContent } = require("../utils");
const { parseSkylink } = require("skynet-js");
const { TestData } = require("testing-corpus");
// corpusCheck runs through all the tests hosted at the resolver skylink created
// by the testing-corpus repo https://github.com/SkynetLabs/testing-corpus
async function corpusCheck(done) {
// Load Test Data from file
const testData = require("../fixtures/testdata.json");
// Loop over test data and execute tests
testData.forEach((test) => {
TestData.forEach((test) => {
if (test.skylink) {
// Skylink Verification
skylinkVerification(done, test);

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +0,0 @@
// Imports
const got = require("got");
// getTestData will download the test data uploaded by the testing-corpus repo
// for the webportal health-checks to use.
async function getTestData() {
try {
const query = `https://040e2npojpl9tiahghgls0d13bvacn5qo9jodruda8lcp3l4q3h1ikg.siasky.net/`;
const json = await got(query).json();
console.log(JSON.stringify(json));
} catch (error) {
console.log(error);
}
}
// Call function
getTestData();

View File

@ -826,6 +826,13 @@ strip-ansi@^6.0.0:
dependencies:
ansi-regex "^5.0.0"
"testing-corpus@https://github.com/SkynetLabs/testing-corpus":
version "1.0.0"
resolved "https://github.com/SkynetLabs/testing-corpus#eadfd250f6cd82c3943a3dbbbeb9e895d3ca3c47"
dependencies:
got "^11.8.2"
hasha "^5.2.2"
to-data-view@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/to-data-view/-/to-data-view-1.1.0.tgz#08d6492b0b8deb9b29bdf1f61c23eadfa8994d00"