Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions zhtp-cli/scripts/run_web4_functional_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
TEST_PHASE="${1:-all}"
VERBOSE="${VERBOSE:-0}"
NOCAPTURE="${NOCAPTURE:-0}"
BUILD_MODE="${BUILD_MODE:-debug}"

# Color codes for output
RED='\033[0;31m'
Expand Down
9 changes: 5 additions & 4 deletions zhtp-cli/tests/web4_functional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ use std::thread;
use std::time::Duration;
use std::io::Write;

mod support;
use support::{TestEnv, CliExecutor, SiteGenerator, StateVerifier};
#[path = "web4_functional/mod.rs"]
mod web4_functional_support;
use web4_functional_support::{TestEnv, CliExecutor, SiteGenerator, StateVerifier};

// ============================================================================
// PHASE 1: DOMAIN REGISTRATION TESTS
Expand Down Expand Up @@ -123,8 +124,8 @@ fn deployment_simple_site() {
site.write_to(&site_path).expect("Failed to write site");

// Deploy
let result = cli.deploy_site("simple.web4.test", &site_path);
assert!(result.success, "Deployment failed: {}", result.output);
let deploy_result = cli.deploy_site("simple.web4.test", &site_path);
assert!(deploy_result.success, "Deployment failed: {}", deploy_result.output);

// Verify manifest
let verify = StateVerifier::new(&env);
Expand Down
20 changes: 12 additions & 8 deletions zhtp-cli/tests/web4_functional/state_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@ impl StateVerifier {

/// Verify manifest has required fields
pub fn manifest_has_fields(&self, domain: &str, required_fields: &[&str]) -> bool {
let manifest = self.get_manifest(domain)?;

for field in required_fields {
if !manifest.contains_key(*field) {
return false;
if let Some(manifest) = self.get_manifest(domain) {
for field in required_fields {
if !manifest.contains_key(*field) {
return false;
}
}
true
} else {
false
}

true
}

/// Get version information for a domain
Expand Down Expand Up @@ -126,7 +127,10 @@ impl StateVerifier {

/// Verify persistence: check if state is identical after restart
pub fn verify_persistence(&self, domain: &str, original_state: &serde_json::Map<String, Value>) -> bool {
let current_state = self.get_manifest(domain)?;
let current_state = match self.get_manifest(domain) {
Some(state) => state,
None => return false,
};

// Compare critical fields
let same_cid = original_state.get("web4_manifest_cid") == current_state.get("web4_manifest_cid");
Expand Down