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

Use the new traversal policy to simplify reharvest #92

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 1 addition & 5 deletions tools/integration/lib/harvester.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Harvester {
const tool = this._harvestToolChecks?.length === 1 ? this._harvestToolChecks[0][0] : 'component'
return components.map(coordinates => {
const result = { tool, coordinates }
if (reharvest) result.policy = 'always'
if (reharvest) result.policy = 'reharvestAlways'
return result
})
}
Expand Down Expand Up @@ -57,10 +57,6 @@ class Harvester {
if (!component) throw new Error('Component not set')
console.log('Start to detect schema versions for harvest tools')
const startTime = Date.now()
//make sure that we have one entire set of harvest results (old or new)
await this.harvest([component])
await new Promise(resolve => setTimeout(resolve, poller.interval))

//trigger a reharvest to overwrite the old result, so we can verify the timestamp is new for completion
await this.harvest([component], true)

Expand Down
11 changes: 1 addition & 10 deletions tools/integration/test/integration/harvestTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,9 @@ async function harvestTillCompletion(components) {
const versionPoller = new Poller(poll.interval / 5, poll.maxTime)
await harvester.detectSchemaVersions(oneComponent, versionPoller, tools)

//make sure that we have one entire set of harvest results (old or new)
console.log('Ensure harvest results exist before starting tests')
const previousHarvests = await harvester.pollForCompletion(components, new Poller(1, 1))
const previousHarvestsComplete = Array.from(previousHarvests.values()).every(v => v)
const poller = new Poller(poll.interval, poll.maxTime)
if (!previousHarvestsComplete) {
await harvester.harvest(components)
await harvester.pollForCompletion(components, poller)
}

//trigger a reharvest to overwrite the old result
console.log('Trigger reharvest to overwrite old results')
await harvester.harvest(components, true)
const poller = new Poller(poll.interval, poll.maxTime)
return harvester.pollForCompletion(components, poller, Date.now())
}
Loading