-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
> During the syncUpstream process, it will attempt to create sync repeatedly until it times out, when the pkg has been published in the self registry. 1. 🐞 When executing the syncTask, filter out scenarios where the target registry is the self registry. ------- > 包迁移至当前 registry 时,收到同步请求会产生无效的同步任务,当 `syncUpstream` 时,会尝试重复创建 sync 直到超时。 1. 🐞 syncTask 执行时,先过滤目标 registry 是当前 registry 的场景。
- Loading branch information
Showing
2 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -719,6 +719,48 @@ describe('test/core/service/PackageSyncerService/executeTask.test.ts', () => { | |
|
||
}); | ||
|
||
it('should skip self registry', async () => { | ||
const name = '@cnpmcore/test-self-sync'; | ||
const { user } = await userService.create({ | ||
name: 'test-user', | ||
password: 'this-is-password', | ||
email: '[email protected]', | ||
ip: '127.0.0.1', | ||
}); | ||
|
||
const registry = await registryManagerService.ensureSelfRegistry(); | ||
|
||
const publishCmd = { | ||
scope: '@cnpmcore', | ||
name: 'test-self-sync', | ||
version: '1.0.0', | ||
description: '1.0.0', | ||
readme: '', | ||
registryId: registry.registryId, | ||
packageJson: { name, test: 'test', version: '1.0.0' }, | ||
dist: { | ||
content: Buffer.alloc(0), | ||
}, | ||
isPrivate: false, | ||
publishTime: new Date(), | ||
skipRefreshPackageManifests: false, | ||
}; | ||
const pkgVersion = await packageManagerService.publish(publishCmd, user); | ||
assert(pkgVersion.version === '1.0.0'); | ||
|
||
await packageSyncerService.createTask(name); | ||
const task = await packageSyncerService.findExecuteTask(); | ||
assert(task); | ||
await packageSyncerService.executeTask(task); | ||
|
||
const stream = await packageSyncerService.findTaskLog(task); | ||
assert(stream); | ||
const log = await TestUtil.readStreamToLog(stream); | ||
// console.log(log); | ||
assert(log.includes(`${name} has been published to the self registry, skip sync ❌❌❌❌❌`)); | ||
|
||
}); | ||
|
||
it('should updated package manifests when version insert duplicated', async () => { | ||
// https://www.npmjs.com/package/@cnpmcore/test-sync-package-has-two-versions | ||
const name = '@cnpmcore/test-sync-package-has-two-versions'; | ||
|