Skip to content

Commit 3c70162

Browse files
committed
test(e2e): make sure test does not depend on the version + debug collected files on ci
1 parent 7b1aedc commit 3c70162

File tree

5 files changed

+13
-16
lines changed

5 files changed

+13
-16
lines changed

meta-cli/src/com/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ async fn config(req: HttpRequest) -> impl Responder {
9090
// thus `dir` must be explicitly set to the canonical typegraph's `workdir`
9191
"dir": artefact_base_dir,
9292
"prismaMigration": {
93-
// only the cli is aware of the convention migrationDir := tg_workdir + config_folder + tg_name
93+
// only the cli is aware of the convention migrationDir := tg_workdir + folder from config + tg_name
9494
"migrationDir": config.prisma_migrations_dir_rel(&parsed.typegraph),
9595
"globalAction": migration_action_glob,
9696
"runtimeAction": migration_action_per_rt
@@ -153,7 +153,7 @@ pub async fn spawn_server() -> std::io::Result<()> {
153153
.service(config)
154154
.service(command)
155155
.service(response)
156-
.app_data(PayloadConfig::new(1000000 * 100))
156+
.app_data(PayloadConfig::new(1000000 * 100)) // 100 mb
157157
})
158158
.listen(tcp_listener)?
159159
.run()

meta-cli/src/com/store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ impl ServerStore {
140140
with_store_mut(|s| {
141141
let mut items = vec![];
142142
if let Some(actions) = s.migration_action.get(&tg_path) {
143-
// remove previous rt action if any
144143
items = actions.as_ref().clone();
145144
}
145+
// remove previous rt action if any
146146
items.retain(|v| v.runtime_name.ne(&rt_migration.runtime_name));
147147
items.push(rt_migration);
148148
s.migration_action.insert(tg_path, items.into());

typegate/tests/e2e/templates/templates_test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@ import { newTempDir, workspaceDir } from "test-utils/dir.ts";
66
import { exists, expandGlob } from "std/fs/mod.ts";
77
import { join } from "std/path/mod.ts";
88
import { assert } from "std/assert/mod.ts";
9-
import { get_version } from "native";
109
import { projectDir } from "../../../../dev/utils.ts";
1110
// import { shell } from "test-utils/shell.ts";
1211

1312
const modifiers: Record<string, (dir: string) => Promise<void> | void> = {
1413
"python": () => {},
1514
"deno": async (dir: string) => {
16-
const version = await get_version();
17-
console.log(version);
1815
for await (const f of expandGlob("**/*.ts", { root: dir })) {
1916
// FIXME: deno is unable to map the types from .d.ts files when used locally
2017
const data = (await Deno.readTextFile(f.path)).replace(
@@ -23,7 +20,7 @@ const modifiers: Record<string, (dir: string) => Promise<void> | void> = {
2320
);
2421
const level = f.path.replace(projectDir, "").split("/").length - 2;
2522
const newData = data.replaceAll(
26-
`npm:@typegraph/sdk@${version}`,
23+
/npm:@typegraph\/sdk@[0-9]+\.[0-9]+\.[0-9]+/g,
2724
`${Array(level).fill("..").join("/")}/typegraph/node/sdk/dist`,
2825
);
2926

typegraph/core/src/utils/fs_host.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use indexmap::IndexMap;
1010

1111
use crate::{
1212
global_store::Store,
13-
wit::metatype::typegraph::host::{expand_glob, get_cwd, read_file, write_file},
13+
wit::metatype::typegraph::host::{eprint, expand_glob, get_cwd, read_file, write_file},
1414
};
1515

1616
pub fn read_text_file<P: Into<String>>(path: P) -> Result<String, String> {
@@ -50,6 +50,10 @@ pub fn common_prefix_paths(paths: &[PathBuf]) -> Option<PathBuf> {
5050
}
5151

5252
pub fn relativize_paths(paths: &[PathBuf]) -> Result<Vec<PathBuf>, String> {
53+
if paths.is_empty() {
54+
return Ok(vec![]);
55+
}
56+
5357
if let Some(common_dir) = common_prefix_paths(paths) {
5458
let ret = paths
5559
.iter()
@@ -62,10 +66,6 @@ pub fn relativize_paths(paths: &[PathBuf]) -> Result<Vec<PathBuf>, String> {
6266
return Ok(ret);
6367
}
6468

65-
if paths.is_empty() {
66-
return Ok(vec![]);
67-
}
68-
6969
Err("Cannot relativize path list if one item is already relative".to_string())
7070
}
7171

@@ -74,14 +74,14 @@ pub fn compress<P: Into<String>>(path: P, exclude: Option<Vec<String>>) -> Resul
7474
let exclude = exclude.unwrap_or_default();
7575
let paths = expand_glob(&path.into(), &exclude)?;
7676
let mut entries = IndexMap::new();
77-
// eprint("Preparing tarball");
77+
eprint("Preparing tarball");
7878

7979
let abs_paths = paths.iter().map(PathBuf::from).collect::<Vec<PathBuf>>();
8080
let rel_paths = relativize_paths(&abs_paths)?;
8181

8282
for (i, abs_path) in abs_paths.iter().enumerate() {
8383
let rel_path_str = rel_paths[i].to_string_lossy();
84-
// eprint(&format!(" ++ {}", rel_path_str.clone()));
84+
eprint(&format!(" ++ {}", rel_path_str.clone()));
8585
// Note: tarball path should be relative
8686
// Note: Strip against workdir does not work when the sdk is spawn from another process
8787
entries.insert(rel_path_str.into(), read_file(&abs_path.to_string_lossy())?);

typegraph/core/src/utils/postprocess/prisma_rt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ impl PrismaProcessor {
6464
Ok(path)
6565
}
6666

67-
/// Get migration action from runtime_name (usually set from the cli)
68-
/// If nothing is found, find the global action config (set initially)
67+
/// Find the appropriate migration action (usually set from the cli)
68+
/// If nothing is found, use the global action config (set initially)
6969
pub fn get_action_by_rt_name(&self, name: &str) -> MigrationAction {
7070
if let Some(actions) = self.config.runtime_actions.clone() {
7171
if let Some(action) = actions.iter().find(|(rt, _)| rt.eq(name)) {

0 commit comments

Comments
 (0)