-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gate,sdk): fail fast on bad credentials before artifact upload (#961
) Solves [MET-793](https://linear.app/metatypedev/issue/MET-793/artifact-upload-allowed-with-wrong-credentials) #### Migration notes None - [x] The change comes with new or modified tests - [ ] Hard-to-understand functions have explanatory comments - [ ] End-user documentation is updated to reflect the change <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes - **New Features** - Added a ping functionality to verify typegate connectivity and credentials - Introduced a new server health check mechanism across multiple language implementations - **Improvements** - Simplified error handling in deployment and query-related functions - Enhanced pre-deployment validation process - **Testing** - Added test coverage for credential validation during deployment - Implemented new test scenarios for typegate connectivity checks <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
1 parent
324dffa
commit eeb69c4
Showing
11 changed files
with
150 additions
and
28 deletions.
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
import { BasicAuth, tgDeploy } from "@typegraph/sdk/tg_deploy"; | ||
|
||
import { Meta } from "test-utils/mod.ts"; | ||
import { tg } from "./self_deploy.ts"; | ||
import { testDir } from "test-utils/dir.ts"; | ||
import { join } from "@std/path/join"; | ||
import { unreachable } from "@std/assert"; | ||
import * as path from "@std/path"; | ||
import { assertStringIncludes } from "@std/assert/string-includes"; | ||
|
||
Meta.test( | ||
{ | ||
name: "typegate should fail after ping on bad credential", | ||
}, | ||
async (t) => { | ||
const gate = `http://localhost:${t.port}`; | ||
const auth = new BasicAuth("admin", "wrong password"); | ||
const cwdDir = join(testDir, "e2e", "self_deploy"); | ||
|
||
try { | ||
const _ = await tgDeploy(tg, { | ||
typegate: { url: gate, auth }, | ||
secrets: {}, | ||
typegraphPath: path.join(cwdDir, "self_deploy.ts"), | ||
migrationsDir: `${cwdDir}/prisma-migrations`, | ||
defaultMigrationAction: { | ||
apply: true, | ||
create: true, | ||
reset: false, | ||
}, | ||
}); | ||
|
||
unreachable(); | ||
} catch(err) { | ||
assertStringIncludes(JSON.stringify(err instanceof Error ? err.message : err), "Failed to access typegate: request failed with status 401 (Unauthorized)"); | ||
} | ||
}, | ||
); |
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