Skip to content

Commit c219920

Browse files
committed
add testWorkspaceQueryLegacyService
1 parent a76b1dc commit c219920

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

tests/Backend/Snowflake/WorkspacesQueryTest.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,4 +321,50 @@ public function testWorkspaceQuery(): void
321321
],
322322
);
323323
}
324+
325+
public function testWorkspaceQueryLegacyService(): void
326+
{
327+
$defaultBranchId = $this->getDefaultBranchId($this);
328+
$branchClient = $this->getBranchAwareDefaultClient($defaultBranchId);
329+
$workspaces = new Workspaces($branchClient);
330+
$workspace = $this->initTestWorkspace(
331+
options: [
332+
'backend' => self::BACKEND_SNOWFLAKE,
333+
'loginType' => WorkspaceLoginType::SNOWFLAKE_LEGACY_SERVICE_PASSWORD,
334+
],
335+
forceRecreate: true,
336+
);
337+
try {
338+
$workspaces->executeQuery(
339+
$workspace['id'],
340+
sprintf(
341+
'CREATE OR REPLACE TABLE %s (ID INT, NAME VARCHAR(32))',
342+
SnowflakeQuote::quoteSingleIdentifier(self::TABLE),
343+
),
344+
);
345+
$this->fail('Executing query on workspace with legacy service login type should fail.');
346+
} catch (ClientException $e) {
347+
$this->assertSame('storage.executeQuery.notSupportedLoginType', $e->getStringCode());
348+
}
349+
350+
$workspace = $this->initTestWorkspace(
351+
options: [
352+
'backend' => self::BACKEND_SNOWFLAKE,
353+
'loginType' => WorkspaceLoginType::DEFAULT,
354+
],
355+
forceRecreate: true,
356+
);
357+
try {
358+
$workspaces->executeQuery(
359+
$workspace['id'],
360+
sprintf(
361+
'CREATE OR REPLACE TABLE %s (ID INT, NAME VARCHAR(32))',
362+
SnowflakeQuote::quoteSingleIdentifier(self::TABLE),
363+
),
364+
);
365+
$this->fail('Executing query on workspace with legacy service login type should fail.');
366+
} catch (ClientException $e) {
367+
$this->assertSame('storage.executeQuery.notSupportedLoginType', $e->getStringCode());
368+
}
369+
}
324370
}

0 commit comments

Comments
 (0)