Add ALD Transition Console preview and Astra lab build workflow
This commit is contained in:
1 parent
f330a3c00a
commit
e5c6a2fc0e
199 files changed
+9866
No files matched your search
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"synthetic": true,
|
||||
"scenario": "cleanup_conflict",
|
||||
"expected_issue_ru": "Ресурс изменён администратором после подготовки"
|
||||
}
|
||||
Vendored
+355
@@ -0,0 +1,355 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"synthetic": true,
|
||||
"scope": {
|
||||
"description": "Синтетический ALD-LAB; не лабораторное доказательство",
|
||||
"complete": false,
|
||||
"denied_or_unreachable": [
|
||||
"offline.corp.local"
|
||||
],
|
||||
"categories": [
|
||||
"users",
|
||||
"groups",
|
||||
"ou",
|
||||
"gpo",
|
||||
"dns",
|
||||
"files",
|
||||
"services"
|
||||
]
|
||||
},
|
||||
"hosts": [
|
||||
{
|
||||
"id": "f82f49bd-be8e-52c6-b45b-18999d545ad9",
|
||||
"fqdn": "ad.corp.local",
|
||||
"addresses": [
|
||||
"192.0.2.10"
|
||||
],
|
||||
"os_family": "WINDOWS",
|
||||
"os_release": "Server 2019",
|
||||
"os_build": "synthetic",
|
||||
"kernel": "",
|
||||
"architecture": "x86_64",
|
||||
"detected_roles": [
|
||||
"AD_DC"
|
||||
],
|
||||
"observed_at": "2026-10-27T12:00:00Z",
|
||||
"evidence_ids": [
|
||||
"synthetic-only"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "1022603f-5a7c-5eff-a792-ae85e7e27a5e",
|
||||
"fqdn": "ald.corp.local",
|
||||
"addresses": [
|
||||
"192.0.2.20"
|
||||
],
|
||||
"os_family": "ASTRA",
|
||||
"os_release": "1.7.7 UU2",
|
||||
"os_build": "synthetic",
|
||||
"kernel": "synthetic",
|
||||
"architecture": "x86_64",
|
||||
"detected_roles": [
|
||||
"PARTIAL_OR_UNKNOWN"
|
||||
],
|
||||
"observed_at": "2026-10-27T12:00:00Z",
|
||||
"evidence_ids": [
|
||||
"synthetic-only"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "1fbb12e0-7cf3-5bab-b27b-6fbf7d0432b7",
|
||||
"fqdn": "ws2025.corp.local",
|
||||
"addresses": [
|
||||
"192.0.2.30"
|
||||
],
|
||||
"os_family": "WINDOWS",
|
||||
"os_release": "Server 2025",
|
||||
"os_build": "synthetic",
|
||||
"kernel": "",
|
||||
"architecture": "x86_64",
|
||||
"detected_roles": [
|
||||
"UNKNOWN"
|
||||
],
|
||||
"observed_at": "2026-10-27T12:00:00Z",
|
||||
"evidence_ids": [
|
||||
"synthetic-only"
|
||||
]
|
||||
}
|
||||
],
|
||||
"objects": [
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "2c9092ac-135c-5bac-836b-25826aca5c44",
|
||||
"sid": "S-1-5-21-100-200-300-1000",
|
||||
"dn": "CN=ald.alice,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "user",
|
||||
"attributes": {
|
||||
"name": "ald.alice",
|
||||
"enabled": true,
|
||||
"privileged": false
|
||||
},
|
||||
"memberships": [
|
||||
"CN=GG-ALD-LAB-Employees,OU=ALD-LAB,DC=corp,DC=local"
|
||||
],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "4c075ce6-353e-5592-8cef-37db6b53579c",
|
||||
"sid": "S-1-5-21-100-200-300-1001",
|
||||
"dn": "CN=ald.bob,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "user",
|
||||
"attributes": {
|
||||
"name": "ald.bob",
|
||||
"enabled": true,
|
||||
"privileged": false
|
||||
},
|
||||
"memberships": [],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "62741d22-dc14-58b1-9027-cb101de2e0ab",
|
||||
"sid": "S-1-5-21-100-200-300-1002",
|
||||
"dn": "CN=ald.carol,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "user",
|
||||
"attributes": {
|
||||
"name": "ald.carol",
|
||||
"enabled": true,
|
||||
"privileged": false
|
||||
},
|
||||
"memberships": [],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "903dd718-ab40-5d84-9408-16227e326277",
|
||||
"sid": "S-1-5-21-100-200-300-1003",
|
||||
"dn": "CN=ald.eve.priv,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "user",
|
||||
"attributes": {
|
||||
"name": "ald.eve.priv",
|
||||
"enabled": true,
|
||||
"privileged": true
|
||||
},
|
||||
"memberships": [],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "25b43933-72f5-5f50-b733-c5d71e6c47c2",
|
||||
"sid": "S-1-5-21-100-200-300-1004",
|
||||
"dn": "CN=ald.dave.disabled,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "user",
|
||||
"attributes": {
|
||||
"name": "ald.dave.disabled",
|
||||
"enabled": false,
|
||||
"privileged": false
|
||||
},
|
||||
"memberships": [],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "b46397fb-b65c-5e50-b46a-d41346c92c06",
|
||||
"sid": "",
|
||||
"dn": "OU=ALD-LAB,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "organizationalUnit",
|
||||
"attributes": {
|
||||
"name": "ALD-LAB"
|
||||
},
|
||||
"memberships": [],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "0a506d9c-baa5-599d-b47e-174db639009b",
|
||||
"sid": "S-1-5-21-100-200-300-1006",
|
||||
"dn": "CN=svc_ald_app,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "service",
|
||||
"attributes": {
|
||||
"name": "svc_ald_app",
|
||||
"spn": "HTTP/app.corp.local"
|
||||
},
|
||||
"memberships": [],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "158b9bba-bf72-55cc-a840-fb85d14833f3",
|
||||
"sid": "S-1-5-21-100-200-300-1020",
|
||||
"dn": "CN=GG-ALD-LAB-Employees,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "group",
|
||||
"attributes": {
|
||||
"name": "GG-ALD-LAB-Employees",
|
||||
"group_scope": "Global"
|
||||
},
|
||||
"memberships": [],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "bd97446a-7ed8-58d7-91c4-8e4801399762",
|
||||
"sid": "S-1-5-21-100-200-300-1021",
|
||||
"dn": "CN=GG-ALD-LAB-IT,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "group",
|
||||
"attributes": {
|
||||
"name": "GG-ALD-LAB-IT",
|
||||
"group_scope": "Global"
|
||||
},
|
||||
"memberships": [],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "ea0e9f58-79df-5e87-90a3-73ed44e94438",
|
||||
"sid": "S-1-5-21-100-200-300-1022",
|
||||
"dn": "CN=GG-ALD-LAB-Helpdesk,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "group",
|
||||
"attributes": {
|
||||
"name": "GG-ALD-LAB-Helpdesk",
|
||||
"group_scope": "Global"
|
||||
},
|
||||
"memberships": [
|
||||
"CN=GG-ALD-LAB-IT,OU=ALD-LAB,DC=corp,DC=local"
|
||||
],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "91b61720-5143-5b4f-a8b0-111c3eeeaa74",
|
||||
"sid": "S-1-5-21-100-200-300-1023",
|
||||
"dn": "CN=GG-ALD-LAB-AppUsers,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "group",
|
||||
"attributes": {
|
||||
"name": "GG-ALD-LAB-AppUsers",
|
||||
"group_scope": "Global"
|
||||
},
|
||||
"memberships": [],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "ef9a9376-7c2f-5c1f-8bdd-076a33145d40",
|
||||
"sid": "S-1-5-21-100-200-300-1024",
|
||||
"dn": "CN=GG-ALD-LAB-Privileged,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "group",
|
||||
"attributes": {
|
||||
"name": "GG-ALD-LAB-Privileged",
|
||||
"group_scope": "Global"
|
||||
},
|
||||
"memberships": [],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "73cc6dde-d791-523b-9847-d55b078ecf93",
|
||||
"sid": "S-1-5-21-100-200-300-1025",
|
||||
"dn": "CN=DL-ALD-LAB-File-Read,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "group",
|
||||
"attributes": {
|
||||
"name": "DL-ALD-LAB-File-Read",
|
||||
"group_scope": "DomainLocal"
|
||||
},
|
||||
"memberships": [],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "f4c84961-d5c7-58fe-b3b1-d17aac1bd04f",
|
||||
"sid": "S-1-5-21-100-200-300-1026",
|
||||
"dn": "CN=DL-ALD-LAB-File-Modify,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "group",
|
||||
"attributes": {
|
||||
"name": "DL-ALD-LAB-File-Modify",
|
||||
"group_scope": "DomainLocal"
|
||||
},
|
||||
"memberships": [],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "6fc2edfc-321e-5204-a15c-1a5a116ba8eb",
|
||||
"sid": "S-1-5-21-100-200-300-1027",
|
||||
"dn": "CN=UG-ALD-LAB-AllTestUsers,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "group",
|
||||
"attributes": {
|
||||
"name": "UG-ALD-LAB-AllTestUsers",
|
||||
"group_scope": "Universal"
|
||||
},
|
||||
"memberships": [],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "f8e41393-6401-55eb-aea4-5cefe012296f",
|
||||
"sid": "",
|
||||
"dn": "CN=ALD-LAB-Share,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "share",
|
||||
"attributes": {
|
||||
"name": "ALD-LAB-Share",
|
||||
"path": "\\\\ad.corp.local\\ALD-LAB",
|
||||
"orphan_sids": [
|
||||
"S-1-5-21-100-200-300-9999"
|
||||
]
|
||||
},
|
||||
"memberships": [],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "32d977ac-0e11-55ab-9f4f-d00ef4074ea7",
|
||||
"sid": "",
|
||||
"dn": "CN=app.corp.local,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "dns",
|
||||
"attributes": {
|
||||
"name": "app.corp.local",
|
||||
"record_type": "CNAME",
|
||||
"target": "ad.corp.local"
|
||||
},
|
||||
"memberships": [],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "0c02afbf-0f0f-5a0e-a07d-a695ae4f5a64",
|
||||
"sid": "",
|
||||
"dn": "CN=GPO-ALD-LAB-UI,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "gpo",
|
||||
"attributes": {
|
||||
"name": "GPO-ALD-LAB-UI",
|
||||
"linked": true
|
||||
},
|
||||
"memberships": [],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "5301cd2b-7eb8-5236-99c7-9b4f357b0abf",
|
||||
"sid": "",
|
||||
"dn": "CN=GPO-ALD-LAB-Application-Access,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "gpo",
|
||||
"attributes": {
|
||||
"name": "GPO-ALD-LAB-Application-Access",
|
||||
"filter": "GG-ALD-LAB-AppUsers"
|
||||
},
|
||||
"memberships": [],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
},
|
||||
{
|
||||
"source_system_id": "66ccac1b-250e-540b-bade-f791da120c9a",
|
||||
"object_guid": "6e7e2c69-52cf-54b2-964c-de23697e444c",
|
||||
"sid": "",
|
||||
"dn": "CN=GPO-ALD-LAB-Disabled-Example,OU=ALD-LAB,DC=corp,DC=local",
|
||||
"object_type": "gpo",
|
||||
"attributes": {
|
||||
"name": "GPO-ALD-LAB-Disabled-Example",
|
||||
"linked": false
|
||||
},
|
||||
"memberships": [],
|
||||
"observed_at": "2026-10-27T12:00:00Z"
|
||||
}
|
||||
],
|
||||
"source_domain": "corp.local"
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"synthetic": true,
|
||||
"scenario": "duplicate_names",
|
||||
"expected_issue_ru": "Одинаковые displayName при разных GUID/SID"
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"synthetic": true,
|
||||
"scenario": "incomplete_deployment",
|
||||
"expected_issue_ru": "Пакеты и конфигурация без доказательства здоровья"
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"synthetic": true,
|
||||
"scenario": "missing_media",
|
||||
"expected_issue_ru": "Пакет aldpro-mp отсутствует, нужен проверенный носитель"
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"synthetic": true,
|
||||
"scenario": "offline_host",
|
||||
"expected_issue_ru": "Узел недоступен, очистка ожидает связи"
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"synthetic": true,
|
||||
"scenario": "orphan_sid",
|
||||
"expected_issue_ru": "SID в ACL не сопоставлен"
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"synthetic": true,
|
||||
"scenario": "same_name_dns",
|
||||
"expected_issue_ru": "corp.local обслуживает AD; переход не проверен"
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"synthetic": true,
|
||||
"scenario": "windows2025",
|
||||
"expected_issue_ru": "SSH не подтверждает интеграцию с ALD"
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
# Authorized laboratory verification — not executed
|
||||
|
||||
Topology: one source forest/domain `corp.local`, one source AD DC, one Astra
|
||||
ALD target, Windows 10, Server 2019 and Server 2025 test targets. Do not invent
|
||||
a second source DC. Preserve the existing network in the actual scenario;
|
||||
192.0.2.x in fixtures is documentation data, never a live default.
|
||||
|
||||
Before running a native integration test, record concrete target authorization,
|
||||
exact builds/roles/updates, installed tool help, snapshots only where valid,
|
||||
AD-aware backup and a tested recovery procedure. No test auto-connects to hosts.
|
||||
|
||||
1. Build Qt app on ALSE 1.7.7 UU2 / selected 6.1-generic / Smolensk with ALD 3.1.
|
||||
Run all unit tests, update actual compatibility evidence, verify vendor
|
||||
allowance for extra DC software. Test 1024×768 and 1440×900 at 100/150/200%.
|
||||
2. Local discovery: clean, packages-only, AD client, ALD client, healthy,
|
||||
degraded and partial DC. Corroborate membership/role independently; a single
|
||||
stopped service must not offer clean installation.
|
||||
3. On each named Windows build, run fixed discovery using prepared OpenSSH
|
||||
native execution and Windows PowerShell 5.1. Verify edition/build/role,
|
||||
optional feature permission failures, known-host mismatch, locked agent,
|
||||
timeout, no DefaultShell change and no background jobs/listeners.
|
||||
4. AD inventory: ordinary/privileged/disabled identities, nested group scopes,
|
||||
rename/duplicate display names, OU, GPO links, scoped denial and 50000 limit.
|
||||
Compare GUID/SID and counts against native UI. Record all uncollected areas.
|
||||
5. Namespace/initialization: obtain vendor-supported same-name transition;
|
||||
verify delivery's interactive installer/help, redacted secret handling,
|
||||
exact prerequisites, planned downtime and partial failure recovery. Do not
|
||||
enable the automated mutation adapter until this succeeds.
|
||||
6. Continuity: old password, machine trust, original profile, DPAPI/EFS as
|
||||
applicable, positive/negative file ACLs, application Kerberos/LDAP/NTLM/SPN,
|
||||
CA/renewal, policy outcomes, post-reboot behavior. Each gets independent
|
||||
manual and automatic evidence and its revision.
|
||||
7. Private executor: root UID/PID peer substitution, wrong machine binding,
|
||||
unknown ID/parameter, oversized/replayed request, altered binary/parent,
|
||||
GUI disconnect, failed pkexec, timeout, no leftover helper/socket/process.
|
||||
8. Access ledger: preserve pre-existing service/firewall/key; own temporary
|
||||
resource restored only when unchanged, externally altered resource conflicts,
|
||||
offline host stays pending, last-channel closure needs console verification.
|
||||
Current preview guides these actions; automated inverse adapters are pending.
|
||||
9. Controlled source-unavailable test with approved recovery and support.
|
||||
AD retirement remains blocked on any missing mandatory outcome. There is no
|
||||
FSMO-to-ALD or direct delete-AD test.
|
||||
10. Install/uninstall: no domain-service/access changes from package hooks;
|
||||
project persistence, incomplete schema rollback, disk-full handling,
|
||||
shutdown during read-only process, no LAN ports/custom agents after close.
|
||||
|
||||
Save machine-derived observations as separate evidence files; do not reuse
|
||||
synthetic fixture observations as vendor or laboratory evidence.
|
||||
@@ -0,0 +1,82 @@
|
||||
#include "core/Rules.h"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <random>
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
using namespace ald::rules;
|
||||
static int checks=0;
|
||||
#define CHECK(x) do { ++checks; if(!(x)) throw std::runtime_error("check failed at line " + std::to_string(__LINE__) + ": " #x); } while(false)
|
||||
template<typename F> void throws(F f){bool did=false;try{f();}catch(const std::invalid_argument&){did=true;}CHECK(did);}
|
||||
int main(){try {
|
||||
for(int exitCode:{0,1,127,255})for(bool normal:{false,true})for(Result post:{Result::Pass,Result::Fail,Result::NotChecked,Result::Error,Result::Unknown}) {
|
||||
const auto r=reconcile(exitCode,normal,post,false,true);
|
||||
CHECK((r==Result::Pass)==(exitCode==0&&normal&&post==Result::Pass));
|
||||
CHECK(reconcile(exitCode,normal,post,true,true)==Result::Unknown);
|
||||
}
|
||||
GateInput gate;gate.sourceDomain=gate.targetDomain="corp.local";
|
||||
gate.inventoryComplete=gate.recoveryRehearsed=gate.windowAuthorized=true;
|
||||
for(const auto *id:{"same_name_transition","credentials","windows_profiles","computer_trust","identity_permissions","applications","policy_outcomes","ad_independence"})gate.requirements.push_back({id,CapabilityState::Verified,Result::Pass,true});
|
||||
CHECK(blockers(gate).empty());
|
||||
gate.requirements.front().support=CapabilityState::DocumentedNotTested;
|
||||
CHECK(!blockers(gate).empty());
|
||||
gate.requirements.front().evidence=Result::Pass; // Human checkbox cannot change support.
|
||||
CHECK(!blockers(gate).empty());
|
||||
gate.requirements.front().support=CapabilityState::Verified;
|
||||
gate.current.mappingDigest="changed";CHECK(!blockers(gate).empty());gate.current=gate.accepted;
|
||||
gate.current.inventoryDigest="changed";CHECK(!blockers(gate).empty());gate.current=gate.accepted;
|
||||
gate.current.policyDigest="changed";CHECK(!blockers(gate).empty());gate.current=gate.accepted;
|
||||
gate.current.revision++;CHECK(!blockers(gate).empty());gate.current=gate.accepted;
|
||||
gate.requirements.clear();CHECK(!blockers(gate).empty());
|
||||
gate.sourceDomain="CORP.LOCAL";gate.targetDomain="corp.local";
|
||||
const auto mixedCase=blockers(gate);
|
||||
CHECK(std::find(mixedCase.begin(),mixedCase.end(),"SAME_NAME_TRANSITION_UNVERIFIED")!=mixedCase.end());
|
||||
RoleFacts clean;clean.astra=clean.packageQueryComplete=true;
|
||||
CHECK(classify(clean)==NodeRole::PartialOrUnknown);
|
||||
clean.configurationObserved=true;CHECK(classify(clean)==NodeRole::CleanAstra);
|
||||
|
||||
RoleFacts f;f.astra=f.packageQueryComplete=f.aldPackages=f.ipaConfig=f.serverConfig=f.servicesObserved=true;
|
||||
CHECK(classify(f)==NodeRole::DcDegraded);CHECK(!canInitialize(classify(f)));
|
||||
f.servicesHealthy=true;CHECK(classify(f)==NodeRole::PartialOrUnknown);
|
||||
f.healthVerified=true;CHECK(classify(f)==NodeRole::DcHealthy);CHECK(!canInitialize(classify(f)));
|
||||
for(bool reachable:{false,true})for(const auto &cur:{"old","applied","external"})CHECK(restoration(false,reachable,cur,"applied",false)==RestoreDecision::Preserve);
|
||||
CHECK(restoration(true,true,"changed","applied",false)==RestoreDecision::Conflict);
|
||||
CHECK(restoration(true,false,"applied","applied",false)==RestoreDecision::Pending);
|
||||
CHECK(restoration(true,true,"applied","applied",true)==RestoreDecision::ManualVerification);
|
||||
CHECK(identityKey("source","ABC","S-1-2")==identityKey("source","abc","S-1-2"));
|
||||
CHECK(identityKey("source","abc","S-1-2")!=identityKey("source","def","S-1-2"));
|
||||
CHECK(identityKey("source","abc","S-1-2")!=identityKey("other","abc","S-1-2"));
|
||||
throws([]{identityKey("source","","sid");});
|
||||
CHECK(!transitionAllowed(RunState::Running,RunState::Completed));
|
||||
CHECK(!transitionAllowed(RunState::RecoveryRequired,RunState::Running));
|
||||
CHECK(transitionAllowed(RunState::Running,RunState::StopRequested));
|
||||
CHECK(!dependenciesPassed({"two","host",{"one"},true},{{"one",Result::Fail}}));
|
||||
CHECK(!dependenciesPassed({"two","host",{"one"},true},{}));
|
||||
CHECK(afterResult(Result::Fail,ErrorPolicy::Independent)==BatchDecision::Continue);
|
||||
CHECK(afterResult(Result::Unknown,ErrorPolicy::Stop)==BatchDecision::Stop);
|
||||
CHECK(afterResult(Result::Error,ErrorPolicy::Pause)==BatchDecision::Pause);
|
||||
throws([]{topological({{"a","x",{"b"},false},{"b","y",{"a"},false}});});
|
||||
throws([]{topological({{"a","x",{"missing"},false}});});
|
||||
throws([]{topological({{"a","x",{},false},{"a","y",{},false}});});
|
||||
for(const auto *bad:{"--help","host;id","a\nwhoami","$(id)","a..b","a.-b","a_.b","a.'b","a/b","a:22","a\\b"})CHECK(!safeHost(bad));
|
||||
CHECK(safeHost("ald.corp.local"));CHECK(safeHost("192.0.2.10"));
|
||||
for(const auto *bad:{"--help","x;id","a b","$x","a\n","a'"})CHECK(!safeUser(bad));
|
||||
CHECK(safeUser("CORP\\admin"));CHECK(safeUser("ald.alice"));
|
||||
for(const auto *bad:{"/abs","../x","x/../y","x//y","C:\\x","x/./y"}) { CHECK(!safeRelativePath(bad)); }
|
||||
CHECK(safeRelativePath("tasks/check.ps1"));
|
||||
const std::vector<std::string> secrets={"password-123","пароль123","abc","bcd"};
|
||||
const std::string input="before password-123 and пароль123 and abcd after";
|
||||
for(std::size_t split=0;split<=input.size();++split){SecretStream s(secrets);auto output=s.feed(input.substr(0,split));output+=s.feed(input.substr(split),true);for(const auto &secret:secrets)CHECK(output.find(secret)==std::string::npos);CHECK(output.find("before")!=std::string::npos);CHECK(output.find("after")!=std::string::npos);}
|
||||
SecretStream overflow({"aaa"});std::string suppressed;
|
||||
for(int i=0;i<10;++i)suppressed+=overflow.feed(std::string(1000,'a'));
|
||||
suppressed+=overflow.feed("aaa after",true);
|
||||
CHECK(suppressed.find("aaa")==std::string::npos);
|
||||
CHECK(suppressed.find("oversized sensitive output")!=std::string::npos);
|
||||
// Reproducible generative properties: chunk partition independence and DAG order.
|
||||
std::mt19937 random(0xA1D310);
|
||||
SecretStream whole(secrets);const auto expected=whole.feed(input,true);
|
||||
for(int trial=0;trial<1000;++trial){SecretStream s(secrets);std::string output;for(std::size_t pos=0;pos<input.size();){auto n=1+random()%9;output+=s.feed(input.substr(pos,n));pos+=n;}output+=s.feed("",true);CHECK(output==expected);
|
||||
std::vector<Step> steps;for(int i=0;i<20;++i){Step step{std::to_string(i),"host",{},false};for(int j=0;j<i;++j)if(random()%5==0)step.dependencies.push_back(std::to_string(j));steps.push_back(step);}std::shuffle(steps.begin(),steps.end(),random);auto order=topological(steps);CHECK(order.size()==steps.size());for(const auto &step:steps)for(const auto &dep:step.dependencies)CHECK(std::find(order.begin(),order.end(),dep)<std::find(order.begin(),order.end(),step.id));
|
||||
}
|
||||
std::cout<<"PASS: "<<checks<<" assertions, including 1000 seeded chunk/DAG trials\n";return 0;
|
||||
}catch(const std::exception &e){std::cerr<<e.what()<<'\n';return 1;}}
|
||||
@@ -0,0 +1,41 @@
|
||||
#include <QtTest>
|
||||
#include <stdexcept>
|
||||
#include "execution/OperationRegistry.h"
|
||||
#include "execution/PlanExecutor.h"
|
||||
#include "security/AccessLedger.h"
|
||||
#include "security/SecretRedactor.h"
|
||||
#include "transports/NativeSshTransport.h"
|
||||
#include "workflows/InitializationPlanner.h"
|
||||
#include "workflows/PolicyPlanner.h"
|
||||
#include "workflows/ComplianceEvaluator.h"
|
||||
#include "adapters/WindowsDiscovery.h"
|
||||
#include <QTemporaryDir>
|
||||
#include <QFile>
|
||||
#include <QCoreApplication>
|
||||
using namespace ald;
|
||||
class RuntimeTests:public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void initTestCase(){Q_INIT_RESOURCE(resources);qRegisterMetaType<ProcessResult>();}
|
||||
void rejectsUnknownExecution(){QVERIFY_EXCEPTION_THROWN(OperationRegistry::resolve("shell.run",{{"command","id"}}),std::runtime_error);QVERIFY_EXCEPTION_THROWN(OperationRegistry::resolve("local.os",{{"path","/etc/shadow"}}),std::runtime_error);OperationRegistry::verifyAssets();}
|
||||
void failedProcessNeverPasses(){ProcessRunner runner;QSignalSpy spy(&runner,&ProcessRunner::finished);ProcessSpec spec;spec.operationId="test";spec.program="/usr/bin/false";runner.start(spec);QVERIFY(spy.wait(5000));auto r=qvariant_cast<ProcessResult>(spy[0][0]);QVERIFY(r.exitCode!=0);QVERIFY(!runner.active());}
|
||||
void zeroExitFailedPostcondition(){PlanExecutor e;ProcessSpec spec;spec.operationId="test";spec.program="/usr/bin/true";QSignalSpy done(&e,&PlanExecutor::finished);e.start({{"test","local",{},false}},{{"test",spec}},{{"test",[](const ProcessResult&){return rules::Result::Fail;}}},rules::ErrorPolicy::Stop);QVERIFY(done.wait(5000));QVERIFY(!done[0][0].toBool());}
|
||||
void journalRefusalStopsBeforeNativeStart(){
|
||||
PlanExecutor e;ProcessSpec spec;spec.operationId="test";spec.program="/usr/bin/true";
|
||||
QSignalSpy done(&e,&PlanExecutor::finished),results(&e,&PlanExecutor::stepFinished);
|
||||
connect(&e,&PlanExecutor::stepStarted,&e,[&e]{e.stop();});
|
||||
e.start({{"test","local",{},false}},{{"test",spec}},{{"test",[](const ProcessResult&){return rules::Result::Pass;}}},rules::ErrorPolicy::Stop);
|
||||
QVERIFY(done.wait(5000));QCOMPARE(results.size(),0);QVERIFY(!done[0][0].toBool());
|
||||
}
|
||||
void missingToolExplained(){ProcessRunner r;ProcessSpec s;s.operationId="missing";s.program="/no-such-ald-tool";QSignalSpy done(&r,&ProcessRunner::finished);r.start(s);QVERIFY(done.wait(5000));QVERIFY(qvariant_cast<ProcessResult>(done[0][0]).failedToStart);}
|
||||
void cancelOwnedProcess(){ProcessRunner r;ProcessSpec s;s.operationId="wait";s.program="/usr/bin/sleep";s.arguments=QStringList{"30"};QSignalSpy done(&r,&ProcessRunner::finished);r.start(s);QTest::qWait(30);r.cancel();QVERIFY(done.wait(5000));QVERIFY(qvariant_cast<ProcessResult>(done[0][0]).cancelled);QVERIFY(!r.active());}
|
||||
void mutationDeniedAtFinalBoundary(){ProcessRunner r;ProcessSpec s;s.operationId="unknown.write";s.program="/usr/bin/true";s.readOnly=false;QVERIFY_EXCEPTION_THROWN(r.start(s),std::runtime_error);}
|
||||
void sshHasNoInterpolation(){QTemporaryDir d;QString known=d.path()+"/known_hosts";QFile f(known);QVERIFY(f.open(QIODevice::WriteOnly));f.write("# explicit test fixture\n");f.close();f.setPermissions(QFile::ReadOwner|QFile::WriteOwner);SshTarget t{"dc.corp.local","CORP\\admin",known,22};auto spec=NativeSshTransport::windowsTask(t,"windows.discovery");QVERIFY(spec.arguments.contains("StrictHostKeyChecking=yes"));QVERIFY(!spec.arguments.last().contains(t.host));QVERIFY(!spec.arguments.last().contains(t.user));QVERIFY(spec.arguments.last().startsWith("powershell.exe -NoLogo -NoProfile -NonInteractive -EncodedCommand "));t.host="x;whoami";QVERIFY_EXCEPTION_THROWN(NativeSshTransport::windowsTask(t,"windows.discovery"),std::runtime_error);}
|
||||
void restorationConflict(){QJsonObject c{{"id","1"},{"owner_marker","run"},{"applied_state",QJsonObject{{"state","on"}}}};QCOMPARE(AccessLedger::assess(c,{{"state","external"}},true,"run").value("decision").toString(),QString("CONFLICT"));QCOMPARE(AccessLedger::assess(c,{},false,"run").value("decision").toString(),QString("PENDING"));QCOMPARE(AccessLedger::assess(c,{},true,"other").value("decision").toString(),QString("PRESERVED"));}
|
||||
void unicodeChunkRedaction(){auto bytes=QString("до пароль после").toUtf8();for(int split=0;split<=bytes.size();++split){SecretRedactor r({"пароль"});auto text=r.feed(bytes.left(split));text+=r.feed(bytes.mid(split),true);QVERIFY(!text.contains("пароль"));QVERIFY(text.contains("до"));QVERIFY(text.contains("после"));}}
|
||||
void degradedInitialization(){auto p=InitializationPlanner::build({{"astra",true}},NodeRole::DcDegraded);QCOMPARE(p.value("state").toString(),QString("BLOCKED"));QVERIFY(!p.value("execution_enabled").toBool());}
|
||||
void ownershipAndIdempotence(){QJsonObject profile{{"settings",QJsonArray{QJsonObject{{"id","x"},{"management_owner","ALD"},{"desired_value",1}}}}};auto conflict=PolicyPlanner::compare(profile,{{"x",QJsonObject{{"management_owner","LOCAL"},{"effective_value",1}}}});QCOMPARE(conflict.value("state").toString(),QString("BLOCKED"));auto same=PolicyPlanner::compare(profile,{{"x",QJsonObject{{"management_owner","ALD"},{"effective_value",1}}}});QVERIFY(same.value("changes").toArray().isEmpty());}
|
||||
void runtimeDoesNotProvePersistent(){auto o=ComplianceEvaluator::evaluate({{"mapping_state","VERIFIED"},{"accepted_value",3}},3,QJsonValue::Undefined);QCOMPARE(o.value("result").toString(),QString("PARTIAL"));}
|
||||
};
|
||||
QTEST_GUILESS_MAIN(RuntimeTests)
|
||||
#include "test_runtime.moc"
|
||||
@@ -0,0 +1,60 @@
|
||||
#include <QtTest>
|
||||
#include <stdexcept>
|
||||
#include "storage/ProjectRepository.h"
|
||||
#include "storage/JsonValidator.h"
|
||||
#include "storage/OfflineBundle.h"
|
||||
#include <QCryptographicHash>
|
||||
#include "adapters/AdInventory.h"
|
||||
#include "workflows/IdentityMapper.h"
|
||||
#include "app/AppController.h"
|
||||
#include <QTemporaryDir>
|
||||
#include <QFile>
|
||||
#include <QSqlQuery>
|
||||
#include <sys/stat.h>
|
||||
using namespace ald;
|
||||
class StorageTests:public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void initTestCase(){Q_INIT_RESOURCE(resources);}
|
||||
void logWithAbsentOptionalContext(){QTemporaryDir dir;ProjectRepository r;r.open(dir.path());r.event({}, {}, "session.open", "INFO", "app", "Открыт проект");const auto events=r.events();QCOMPARE(events.size(),1);const auto event=events[0].toObject();QCOMPARE(event.value("message_ru").toString(),QString("Открыт проект"));QVERIFY(event.value("run_id").isString());QCOMPARE(event.value("redacted_detail").toString(),QString(""));}
|
||||
void checklistSurvivesReopenAndExportsSchema(){
|
||||
QTemporaryDir dir;const auto project=dir.path()+"/project",output=dir.path()+"/checklist.json";
|
||||
{
|
||||
AppController c;c.open(project,true);
|
||||
c.recordHuman({{"item_id","namespace"},{"host_id","corp.local"},{"checked_by","Тестовый оператор"},{"result","PASS"},{"note","Синтетическая проверка <script>"}});
|
||||
c.exportChecklist(output,false);
|
||||
}
|
||||
AppController reopened;reopened.open(project,true);const auto observations=reopened.observations();
|
||||
QCOMPARE(observations.size(),1);QCOMPARE(observations[0].toObject().value("result").toString(),QString("PASS"));
|
||||
QCOMPARE(reopened.migrationPlan().value("state").toString(),QString("BLOCKED"));
|
||||
QFile f(output);QVERIFY(f.open(QIODevice::ReadOnly));const auto exported=JsonValidator::parse(f.readAll(),"checklist").object();
|
||||
QCOMPARE(exported.value("items").toArray().size(),17);QCOMPARE(exported.value("observations").toArray().size(),1);
|
||||
}
|
||||
void roundTripAndSingleWriter(){QTemporaryDir dir;ProjectRepository first;first.open(dir.path());first.save("test","id",{{"cyrillic","Привет"}});QCOMPARE(first.load("test","id").value("cyrillic").toString(),QString("Привет"));ProjectRepository second;QVERIFY_EXCEPTION_THROWN(second.open(dir.path()),std::runtime_error);struct stat st{};QVERIFY(stat(QFile::encodeName(dir.path()+"/project.sqlite").constData(),&st)==0);QCOMPARE(st.st_mode&077,mode_t(0));}
|
||||
void preserveHumanHistory(){QTemporaryDir dir;ProjectRepository r;r.open(dir.path());r.observe({{"item_id","login"},{"host_id","host"},{"method","HUMAN"},{"result","PASS"},{"checked_by","operator"},{"note","<script>alert(1)</script>"}},"old");auto rows=r.observations("new");QCOMPARE(rows.size(),1);QCOMPARE(rows[0].toObject().value("result").toString(),QString("STALE"));QCOMPARE(rows[0].toObject().value("original_result").toString(),QString("PASS"));r.exportChecklist(dir.path()+"/out.html",QJsonArray{QJsonObject{{"id","login"},{"title_ru","Проверить <script>"}}},"new",true);QFile f(dir.path()+"/out.html");QVERIFY(f.open(QIODevice::ReadOnly));auto b=f.readAll();QVERIFY(!b.contains("<script>"));QVERIFY(b.contains("<script>"));}
|
||||
void crashDoesNotReplay(){QTemporaryDir dir;{ProjectRepository r;r.open(dir.path());r.journalRun("run","RUNNING",{{"operation_id","test"}});}ProjectRepository next;next.open(dir.path());QCOMPARE(next.interruptedRuns().size(),1);QCOMPARE(next.interruptedRuns()[0].toObject().value("state").toString(),QString("RECOVERY_REQUIRED"));}
|
||||
void noSecretFields(){QVERIFY_EXCEPTION_THROWN(JsonValidator::ensureDataOnly(QJsonObject{{"attributes",QJsonObject{{"unicodePwd","forbidden"}}}}),std::runtime_error);}
|
||||
void canonicalOrder(){QJsonObject a{{"b",2},{"a",1}},b{{"a",1},{"b",2}};QCOMPARE(JsonValidator::digest(a),JsonValidator::digest(b));b["a"]=3;QVERIFY(JsonValidator::digest(a)!=JsonValidator::digest(b));}
|
||||
void inventoryValidation(){QFile f(":/fixtures/demo.inventory.json");QVERIFY(f.open(QIODevice::ReadOnly));auto b=f.readAll();auto o=AdInventory::parse(b,true);QVERIFY_EXCEPTION_THROWN(AdInventory::parse(b,false),std::runtime_error);auto objects=o["objects"].toArray();objects.append(objects[0]);o["objects"]=objects;QVERIFY_EXCEPTION_THROWN(AdInventory::parse(QJsonDocument(o).toJson(),true),std::runtime_error);}
|
||||
void otherDomainRejected(){QFile f(":/fixtures/demo.inventory.json");QVERIFY(f.open(QIODevice::ReadOnly));auto o=QJsonDocument::fromJson(f.readAll()).object();o["source_domain"]="other.example";QVERIFY_EXCEPTION_THROWN(AdInventory::parse(QJsonDocument(o).toJson(),true),std::runtime_error);}
|
||||
void identityRename(){QJsonObject source{{"source_system_id","source"},{"object_guid","ABC"},{"sid","S-1-2"},{"dn","CN=old"}};auto map=IdentityMapper::reconcile({source},{});auto old=map[0].toObject();old["target_id"]="stable-target";map[0]=old;source["dn"]="CN=renamed";auto next=IdentityMapper::reconcile({source},map);QCOMPARE(next[0].toObject().value("target_id").toString(),QString("stable-target"));source["object_guid"]="DEF";auto collision=IdentityMapper::reconcile({source},map);QCOMPARE(collision.size(),2);QVERIFY(collision[0].toObject().value("target_id").isNull());}
|
||||
void invalidJsonAndSchema(){QVERIFY_EXCEPTION_THROWN(JsonValidator::parse(QByteArray(17*1024*1024,'x'),"project"),std::runtime_error);QVERIFY_EXCEPTION_THROWN(JsonValidator::parse("{\"schema_version\":2}","project"),std::runtime_error);QVERIFY_EXCEPTION_THROWN(JsonValidator::parse("{}","../project"),std::runtime_error);}
|
||||
void duplicateJsonKeysRejected(){
|
||||
QFile f(":/fixtures/demo.inventory.json");QVERIFY(f.open(QIODevice::ReadOnly));auto bytes=f.readAll();
|
||||
bytes.insert(1,"\"schema_version\":1,");
|
||||
QVERIFY_EXCEPTION_THROWN(JsonValidator::parse(bytes,"inventory"),std::runtime_error);
|
||||
const QByteArray escaped="{\"x\":1,\"\\u0078\":2}";
|
||||
QVERIFY_EXCEPTION_THROWN(JsonValidator::parse(escaped,"project"),std::runtime_error);
|
||||
}
|
||||
void dataBundleBoundaries(){
|
||||
QFile f(":/fixtures/demo.inventory.json");QVERIFY(f.open(QIODevice::ReadOnly));const auto data=f.readAll();
|
||||
QJsonObject artifact{{"path","inventory/lab.json"},{"kind","inventory"},{"sha256",QString::fromLatin1(QCryptographicHash::hash(data,QCryptographicHash::Sha256).toHex())},{"base64",QString::fromLatin1(data.toBase64())},{"source_id","synthetic-lab"}};
|
||||
QJsonObject bundle{{"schema_version",1},{"revision",1},{"provenance",QJsonObject{{"publisher","Synthetic test"},{"version","1"},{"source_url","local synthetic fixture"},{"signature_reference","Not signed: test only"}}},{"artifacts",QJsonArray{artifact}}};
|
||||
auto good=OfflineBundle::inspect(QJsonDocument(bundle).toJson());QCOMPARE(good.value("acceptance_state").toString(),QString("REVIEW_REQUIRED"));
|
||||
for(const auto &path:QStringList{"../escape.json","/absolute.json","x/../../a.json"}){auto bad=artifact;bad["path"]=path;bundle["artifacts"]=QJsonArray{bad};QVERIFY_EXCEPTION_THROWN(OfflineBundle::inspect(QJsonDocument(bundle).toJson()),std::runtime_error);}
|
||||
artifact["sha256"]=QString(64,'0');bundle["artifacts"]=QJsonArray{artifact};QVERIFY_EXCEPTION_THROWN(OfflineBundle::inspect(QJsonDocument(bundle).toJson()),std::runtime_error);
|
||||
}
|
||||
void noWaiverPass(){QTemporaryDir dir;ProjectRepository r;r.open(dir.path());QVERIFY_EXCEPTION_THROWN(r.observe({{"item_id","x"},{"host_id","h"},{"checked_by","op"},{"result","PASS"},{"method","HUMAN"},{"applicability","NOT_APPLICABLE_WITH_REASON"},{"note","waiver"}},"context"),std::runtime_error);}
|
||||
};
|
||||
QTEST_GUILESS_MAIN(StorageTests)
|
||||
#include "test_storage.moc"
|
||||
@@ -0,0 +1,49 @@
|
||||
#include <QtTest>
|
||||
#include "app/AppController.h"
|
||||
#include "ui/MainWindow.h"
|
||||
#include "ui/Theme.h"
|
||||
#include "ui/PixelDecoration.h"
|
||||
#include "ui/models/JsonTableModel.h"
|
||||
#include <QTemporaryDir>
|
||||
#include <QListWidget>
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
#include <QStackedWidget>
|
||||
#include <QTableView>
|
||||
#include <QDir>
|
||||
using namespace ald;
|
||||
class UiTests:public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void explicitDemoAndKeyboard(){QTemporaryDir dir;AppController c;c.open(dir.path(),true);ui::Theme::apply(*qobject_cast<QApplication*>(QApplication::instance()));ui::MainWindow w(c);w.setSmokeTest(true);w.resize(1024,768);w.show();QTest::qWait(50);auto *nav=w.findChild<QListWidget*>("navigation");QVERIFY(nav);QCOMPARE(nav->count(),10);nav->setFocus();QTest::keyClick(nav,Qt::Key_Down);QCOMPARE(nav->currentRow(),1);auto *pages=w.findChild<QStackedWidget*>();QVERIFY(pages);QCOMPARE(pages->count(),10);QCOMPARE(c.migrationPlan().value("state").toString(),QString("BLOCKED"));QVERIFY(c.inventory().value("synthetic").toBool());QVERIFY(!c.busy());w.close();QTest::qWait(50);QVERIFY(!w.isVisible());QVERIFY(!c.busy());}
|
||||
void importedTooltipEscaped(){
|
||||
ui::JsonTableModel model({"name"},{"Имя"});model.setRows({QJsonObject{{"name","<img src='https://example.invalid/pixel'>"}}});
|
||||
const auto index=model.index(0,0);QVERIFY(model.data(index,Qt::DisplayRole).toString().contains("<img"));
|
||||
const auto tooltip=model.data(index,Qt::ToolTipRole).toString();QVERIFY(!tooltip.contains("<img"));QVERIFY(tooltip.contains("<img"));
|
||||
}
|
||||
void narrowPagesKeepActionsReachable(){
|
||||
QTemporaryDir dir;AppController c;c.open(dir.path(),true);
|
||||
ui::Theme::apply(*qobject_cast<QApplication*>(QApplication::instance()));
|
||||
ui::MainWindow w(c);w.setSmokeTest(true);w.resize(1024,768);w.show();QTest::qWait(30);
|
||||
auto *nav=w.findChild<QListWidget*>("navigation");auto *pages=w.findChild<QStackedWidget*>();
|
||||
QVERIFY(nav);QVERIFY(pages);QCOMPARE(w.size(),QSize(1024,768));
|
||||
const auto capture=qEnvironmentVariable("ALD_TEST_CAPTURE_DIR");
|
||||
if(!capture.isEmpty())QVERIFY(QDir().mkpath(capture));
|
||||
for(int page=0;page<nav->count();++page){
|
||||
nav->setFocus();if(page)QTest::keyClick(nav,Qt::Key_Down);
|
||||
QTest::qWait(10);QCOMPARE(pages->currentIndex(),page);
|
||||
auto *current=pages->currentWidget();
|
||||
for(auto *table:current->findChildren<QTableView*>())if(table->model()->rowCount())table->selectRow(0);
|
||||
for(auto *button:current->findChildren<QPushButton*>(QString(),Qt::FindDirectChildrenOnly)){
|
||||
QVERIFY2(button->isVisible(),qPrintable(button->text()));
|
||||
QVERIFY2(current->rect().contains(button->geometry()),qPrintable(button->text()));
|
||||
}
|
||||
if(!capture.isEmpty())QVERIFY(w.grab().save(capture+QString("/narrow-%1.png").arg(page+1,2,10,QChar('0'))));
|
||||
}
|
||||
w.close();QTest::qWait(20);QVERIFY(!w.isVisible());QVERIFY(!c.busy());
|
||||
}
|
||||
void reducedMotionStopsDecoration(){ui::PixelDecoration pixel;pixel.setReducedMotion(false);pixel.pulse();QVERIFY(pixel.animating());pixel.setReducedMotion(true);QVERIFY(!pixel.animating());pixel.pulse();QVERIFY(!pixel.animating());}
|
||||
void manualPassDoesNotAuthorizeMigration(){QTemporaryDir dir;AppController c;c.open(dir.path(),true);c.recordHuman({{"item_id","namespace"},{"host_id","corp.local"},{"checked_by","test operator"},{"result","PASS"},{"note","synthetic only"}});QCOMPARE(c.migrationPlan().value("state").toString(),QString("BLOCKED"));QCOMPARE(c.migrationPlan().value("authorization_state").toString(),QString("NOT_AUTHORIZED"));}
|
||||
};
|
||||
QTEST_MAIN(UiTests)
|
||||
#include "test_ui.moc"
|
||||
Reference in new issue
Block a user