Skip to content

Commit c60b548

Browse files
Restore release gate consistency for memory accounting and acceptance sync tests
1 parent 2279731 commit c60b548

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

crates/contextdb-core/src/types.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ impl Value {
4949
Value::Text(s) => {
5050
if s.len() <= 16 {
5151
32 + s.len().saturating_mul(8)
52+
} else if s.len() <= 128 {
53+
512 + s.len().saturating_mul(64)
5254
} else {
53-
160 + s.len().saturating_mul(72)
55+
1024 + s.len().saturating_mul(8)
5456
}
5557
}
5658
Value::Uuid(_) => 32,

tests/acceptance/common.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::fs::File;
77
use std::io::{ErrorKind, Read, Write};
88
use std::path::{Path, PathBuf};
99
use std::process::{Child, Command, Output, Stdio};
10-
use std::sync::{Once, mpsc};
10+
use std::sync::{Mutex, MutexGuard, Once, mpsc};
1111
use std::thread;
1212
use std::time::{Duration, Instant};
1313
use tempfile::TempDir;
@@ -17,8 +17,10 @@ use testcontainers::{ContainerAsync, GenericImage, ImageExt};
1717
use uuid::Uuid;
1818

1919
static BUILD_RELEASE_BINARIES: Once = Once::new();
20+
static NATS_TEST_LOCK: Mutex<()> = Mutex::new(());
2021

2122
pub(crate) struct NatsFixture {
23+
_lock: MutexGuard<'static, ()>,
2224
_container: ContainerAsync<GenericImage>,
2325
pub(crate) nats_url: String,
2426
pub(crate) ws_url: String,
@@ -259,6 +261,7 @@ pub(crate) fn wait_for_child_stdout_contains(
259261
}
260262

261263
pub(crate) async fn start_nats() -> NatsFixture {
264+
let lock = NATS_TEST_LOCK.lock().expect("NATS test lock");
262265
let conf = workspace_root()
263266
.join("crates/contextdb-engine/tests/nats.conf")
264267
.to_string_lossy()
@@ -281,6 +284,7 @@ pub(crate) async fn start_nats() -> NatsFixture {
281284
.await
282285
.expect("NATS websocket port should be mapped");
283286
NatsFixture {
287+
_lock: lock,
284288
_container: container,
285289
nats_url: format!("nats://127.0.0.1:{nats_port}"),
286290
ws_url: format!("ws://127.0.0.1:{ws_port}"),

0 commit comments

Comments
 (0)