Execute query via CLI and expect failure
(&self, query: &str)
| 108 | |
| 109 | /// Execute query via CLI and expect failure |
| 110 | pub fn assert_query_fails(&self, query: &str) -> String { |
| 111 | let output = Command::new("cargo") |
| 112 | .args([ |
| 113 | "run", |
| 114 | "--quiet", |
| 115 | "--package", |
| 116 | "gql-cli", |
| 117 | "--bin", |
| 118 | "graphlite", |
| 119 | "--", |
| 120 | "query", |
| 121 | ]) |
| 122 | .arg("--path") |
| 123 | .arg(&self.db_path) |
| 124 | .arg("--user") |
| 125 | .arg(&self.admin_user) |
| 126 | .arg("--password") |
| 127 | .arg(&self.admin_password) |
| 128 | .arg("--format") |
| 129 | .arg("json") |
| 130 | .arg(query) |
| 131 | .env("RUST_LOG", "error") // Suppress INFO logs in CLI output |
| 132 | .output() |
| 133 | .expect("Failed to execute query"); |
| 134 | |
| 135 | // Query should fail |
| 136 | assert!( |
| 137 | !output.status.success(), |
| 138 | "Expected query to fail but it succeeded: {}", |
| 139 | query |
| 140 | ); |
| 141 | |
| 142 | String::from_utf8_lossy(&output.stderr).to_string() |
| 143 | } |
| 144 | |
| 145 | /// Get unique schema name for test isolation |
| 146 | pub fn schema_name(&self) -> String { |
no outgoing calls
no test coverage detected