Merge pull request #1150 from QwenLM/mingholy/ci/skip-case

test: skip qwen-oauth test in containerized environments
This commit is contained in:
Mingholy
2025-12-04 20:53:12 +08:00
committed by GitHub
2 changed files with 36 additions and 15 deletions

View File

@@ -438,10 +438,15 @@ describe('Configuration Options (E2E)', () => {
} }
}); });
it('should accept authType: qwen-oauth', async () => { // Skip in containerized sandbox environments - qwen-oauth requires user interaction
// Note: qwen-oauth requires credentials in ~/.qwen // which is not possible in Docker/Podman CI environments
// This test may fail if credentials are not configured it.skipIf(
// The test verifies the option is accepted and passed correctly process.env['SANDBOX'] === 'sandbox:docker' ||
process.env['SANDBOX'] === 'sandbox:podman',
)('should accept authType: qwen-oauth', async () => {
// Note: qwen-oauth requires credentials in ~/.qwen and user interaction
// Without credentials, the auth process will timeout waiting for user
// This test verifies the option is accepted and passed correctly to CLI
const stderrMessages: string[] = []; const stderrMessages: string[] = [];
@@ -452,6 +457,7 @@ describe('Configuration Options (E2E)', () => {
cwd: testDir, cwd: testDir,
authType: 'qwen-oauth', authType: 'qwen-oauth',
debug: true, debug: true,
logLevel: 'debug',
stderr: (msg: string) => { stderr: (msg: string) => {
stderrMessages.push(msg); stderrMessages.push(msg);
}, },
@@ -461,16 +467,31 @@ describe('Configuration Options (E2E)', () => {
const messages: SDKMessage[] = []; const messages: SDKMessage[] = [];
try { try {
// Use a timeout to avoid hanging when credentials are not configured
const timeoutPromise = new Promise<'timeout'>((resolve) =>
setTimeout(() => resolve('timeout'), 20000),
);
const collectMessages = async () => {
for await (const message of q) { for await (const message of q) {
messages.push(message); messages.push(message);
} }
return 'completed';
};
// The query should at least start (may fail due to missing credentials) const result = await Promise.race([collectMessages(), timeoutPromise]);
if (result === 'timeout') {
// Timeout is expected when OAuth credentials are not configured
// Verify that CLI was spawned with correct --auth-type argument
const hasAuthTypeArg = stderrMessages.some((msg) =>
msg.includes('--auth-type'),
);
expect(hasAuthTypeArg).toBe(true);
} else {
// If credentials exist and auth completed, verify we got messages
expect(messages.length).toBeGreaterThan(0); expect(messages.length).toBeGreaterThan(0);
} catch (error) { }
// qwen-oauth may fail if credentials are not configured
// This is acceptable - we're testing that the option is passed correctly
expect(error).toBeDefined();
} finally { } finally {
await q.close(); await q.close();
} }

View File

@@ -449,8 +449,8 @@ export async function main() {
} }
const nonInteractiveConfig = await validateNonInteractiveAuth( const nonInteractiveConfig = await validateNonInteractiveAuth(
settings.merged.security?.auth?.selectedType || (argv.authType as AuthType) ||
(argv.authType as AuthType), settings.merged.security?.auth?.selectedType,
settings.merged.security?.auth?.useExternal, settings.merged.security?.auth?.useExternal,
config, config,
settings, settings,