Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(cli): load PowerShell module in rate-limit test (#44439)

Stephen Zhou004315fe5bd9
diff --git a/cli/scripts/install.ps1.test.ts b/cli/scripts/install.ps1.test.ts
index e56e2b5467b..d0b77225048 100644
--- a/cli/scripts/install.ps1.test.ts
+++ b/cli/scripts/install.ps1.test.ts
@@ -289,11 +289,13 @@ describe.skipIf(!PWSH)('install.ps1 rate limit', () => {
it('Resolve-Release surfaces the rate-limit hint and exits, not "not found"', () => {
const stub = `function Invoke-RestMethod { throw [Microsoft.PowerShell.Commands.HttpResponseException]::new('rate limited', $script:rlResp) }`
- const setup = `$script:rlResp = [System.Net.Http.HttpResponseMessage]::new([System.Net.HttpStatusCode]403)
+ // The stub bypasses Invoke-RestMethod's module autoload, which provides HttpResponseException.
+ const setup = `Import-Module Microsoft.PowerShell.Utility
+ $script:rlResp = [System.Net.Http.HttpResponseMessage]::new([System.Net.HttpStatusCode]403)
$script:rlResp.Headers.TryAddWithoutValidation('x-ratelimit-remaining','0') | Out-Null
$script:rlResp.Headers.TryAddWithoutValidation('x-ratelimit-reset','${futureReset}') | Out-Null`
const r = runPwsh(`${setup}\n${stub}\nResolve-Release`, { DIFY_VERSION: '1.15.0' })
- expect(r.code).not.toBe(0)
+ expect(r.code).toBe(1)
expect(r.stderr).toContain('rate limit exceeded')
expect(r.stderr).not.toContain('not found')
})