Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

mock(fixtures): scale default fixture sizes to a mature SMB homelab

rcourtmancef057943ad4
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 0d8af83b73..d1ea4fa20d 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -795,6 +795,16 @@ local demos. `scripts/toggle-mock.sh` must seed the same `PULSE_MOCK_*`
defaults as `internal/mock.DefaultConfig`, so managed runtime toggles, local
demo restarts, and CLI mock status all converge on one canonical dataset
instead of drifting across shell helpers.
+The canonical mock density today targets a mature small-to-mid homelab /
+SMB environment so platform-first pages exercise real table density on
+first boot. Both `mock_default_entries()` in `scripts/toggle-mock.sh`
+and `internal/mock.DefaultConfig` carry the same baseline: 5 Proxmox
+nodes with 6 VMs and 8 LXCs each, 5 Docker hosts with 14 containers
+each, 4 standalone Pulse-managed hosts, and 1 Kubernetes cluster with
+5 nodes, 40 pods, and 14 deployments. Bumping either side requires
+bumping the other (and the matching `scripts/tests/test-toggle-mock.sh`
+fixtures) so toggle CLIs, managed runtime restarts, and the in-binary
+default never drift apart.
That same hosted runtime rollout boundary also owns public routing identity for
managed tenants. `internal/cloudcp/docker/labels.go`,
`internal/cloudcp/docker/manager.go`, and
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.md
index add1c8b427..986e057243 100644
--- a/docs/release-control/v6/internal/subsystems/monitoring.md
+++ b/docs/release-control/v6/internal/subsystems/monitoring.md
@@ -429,6 +429,19 @@ generic fixture synthesis, but that authored layer must stay graph-native and
runtime-stable so infrastructure, workloads, storage, and recovery all present
the same human-readable platform story instead of a lab of random names,
legacy `mock-cluster` labels, or surface-specific mock overrides.
+Mock fixture defaults in `internal/mock/generator.go` (the `DefaultConfig`
+constant) are also part of that mock-runtime contract. They target a
+mature small-to-mid homelab / SMB environment so platform-first pages
+exercise table density, sorting, grouping, drawer behavior, and
+responsive layout out of the box: 5 Proxmox cluster + standalone nodes
+with 6 VMs and 8 LXCs each, 5 Docker/Podman hosts with 14 containers
+each, 4 standalone Pulse-managed hosts, and 1 Kubernetes cluster with
+5 nodes, 40 pods, and 14 deployments. Bumps to those defaults must
+keep the curated demo scenario's per-node hostname seasoning in
+`demo_scenarios.go` aligned (today: pve1..pve6 with regional labels,
+shared-fabric storage names, and per-node fallback naming) so the
+broadcast and snapshot views render the same human-readable estate
+regardless of the configured fixture size.
That same chart boundary also owns storage-series identity. Monitoring and
`ReadState` consumers must address storage pool and physical-disk history
through the resolved unified-resource metrics target, so seeded history,
diff --git a/internal/mock/demo_scenarios.go b/internal/mock/demo_scenarios.go
index 722fda8948..57f7827e36 100644
--- a/internal/mock/demo_scenarios.go
+++ b/internal/mock/demo_scenarios.go
@@ -834,8 +834,10 @@ func scenarioStorageAliasForNode(name, node string) string {
return "dr-a-iso-library"
case "pve5":
return "dr-b-iso-library"
+ case "pve6":
+ return "dr-c-iso-library"
default:
- return "iso-library"
+ return fmt.Sprintf("%s-iso-library", normalizedNode)
}
case "local-zfs":
switch normalizedNode {
@@ -849,8 +851,10 @@ func scenarioStorageAliasForNode(name, node string) string {
return "dr-a-service-pool"
case "pve5":
return "dr-b-service-pool"
+ case "pve6":
+ return "dr-c-service-pool"
default:
- return "service-pool"
+ return fmt.Sprintf("%s-service-pool", normalizedNode)
}
default:
return trimmedName
diff --git a/internal/mock/demo_scenarios_test.go b/internal/mock/demo_scenarios_test.go
index fa63abe32b..75ca5124df 100644
--- a/internal/mock/demo_scenarios_test.go
+++ b/internal/mock/demo_scenarios_test.go
@@ -76,6 +76,21 @@ func TestBuildFixtureGraphAppliesCuratedDemoScenarioAcrossEstate(t *testing.T) {
}
}
+func TestDemoScenarioStorageNamingHandlesScaledNodeCount(t *testing.T) {
+ cfg := DefaultConfig
+ cfg.NodeCount = 6
+ cfg.RandomMetrics = false
+
+ graph := buildFixtureGraph(cfg, time.Date(2026, time.April, 1, 12, 0, 0, 0, time.UTC))
+
+ if storageNameExists(graph, "service-pool") {
+ t.Fatal("expected demo storage naming to keep the generic service-pool alias retired even when NodeCount > 5")
+ }
+ if storageNameExists(graph, "iso-library") {
+ t.Fatal("expected demo storage naming to keep the generic iso-library alias retired even when NodeCount > 5")
+ }
+}
+
func TestFixtureGraphUpdateMetricsPreservesCuratedDemoScenario(t *testing.T) {
cfg := DefaultConfig
cfg.RandomMetrics = false
diff --git a/internal/mock/generator.go b/internal/mock/generator.go
index 808a67ca0c..3760f76ebe 100644
--- a/internal/mock/generator.go
+++ b/internal/mock/generator.go
@@ -61,17 +61,28 @@ const (
hostConnectionPrefix = "host-"
)
+// Default fixture sizes target a mature small-to-mid homelab / SMB
+// environment so platform pages exercise table density, sorting,
+// grouping, drawer behavior, and responsive layout out of the box:
+// - 5 Proxmox nodes (cluster + standalone) with 6 VMs and 8 LXCs each.
+// NodeCount stays at 5 to keep the curated demo scenario in
+// `internal/mock/demo_scenarios.go` (which seasons pve1..pve5 with
+// regional labels and shared-fabric storage) the single source of
+// truth for hostname presentation in mock mode.
+// - 5 Docker/Podman hosts with 14 containers each
+// - 4 standalone Pulse-managed hosts
+// - 1 Kubernetes cluster with 5 nodes, 40 pods, and 14 deployments
var DefaultConfig = MockConfig{
- NodeCount: 3,
- VMsPerNode: 3,
- LXCsPerNode: 3,
- DockerHostCount: 2,
- DockerContainersPerHost: 5,
- GenericHostCount: 2,
+ NodeCount: 5,
+ VMsPerNode: 6,
+ LXCsPerNode: 8,
+ DockerHostCount: 5,
+ DockerContainersPerHost: 14,
+ GenericHostCount: 4,
K8sClusterCount: 1,
- K8sNodesPerCluster: 3,
- K8sPodsPerCluster: 10,
- K8sDeploymentsPerCluster: 4,
+ K8sNodesPerCluster: 5,
+ K8sPodsPerCluster: 40,
+ K8sDeploymentsPerCluster: 14,
RandomMetrics: true,
StoppedPercent: 0.06,
UpdateInterval: defaultMockUpdateInterval,
diff --git a/internal/monitoring/monitor_unified_state_test.go b/internal/monitoring/monitor_unified_state_test.go
index 50a6c68e45..11ae6eda45 100644
--- a/internal/monitoring/monitor_unified_state_test.go
+++ b/internal/monitoring/monitor_unified_state_test.go
@@ -511,8 +511,13 @@ func TestMonitorBuildBroadcastFrontendStateUsesCanonicalMockUnifiedResources(t *
if !hasFrontendResourceName(frontend.Resources, legacyName) {
t.Fatalf("expected mock-mode broadcast state to include legacy mock resource %q, got %#v", legacyName, frontend.Resources)
}
- if len(frontend.Resources) != len(expectedResources) {
- t.Fatalf("expected mock-mode broadcast state to mirror canonical unified resource count %d, got %d", len(expectedResources), len(frontend.Resources))
+ // The broadcast path coalesces resources that share a canonical host
+ // merge key (for example, a Kubernetes node that the registry already
+ // linked to its host agent), so the broadcast count is the coalesced
+ // view of the canonical snapshot rather than the raw snapshot count.
+ expectedBroadcastCount := len(coalesceBroadcastResources(expectedResources))
+ if len(frontend.Resources) != expectedBroadcastCount {
+ t.Fatalf("expected mock-mode broadcast state to mirror coalesced canonical unified resource count %d, got %d (raw snapshot count %d)", expectedBroadcastCount, len(frontend.Resources), len(expectedResources))
}
if freshness.IsZero() {
t.Fatal("expected canonical mock unified snapshot freshness")
diff --git a/scripts/tests/test-toggle-mock.sh b/scripts/tests/test-toggle-mock.sh
index cbca4c13e5..79f839bc22 100755
--- a/scripts/tests/test-toggle-mock.sh
+++ b/scripts/tests/test-toggle-mock.sh
@@ -177,16 +177,16 @@ test_ensure_mock_env_file_seeds_canonical_demo_defaults() {
env_contents="${output}"
assert_contains "ensure_mock_env_file seeds mock mode default" "${env_contents}" "PULSE_MOCK_MODE=false"
- assert_contains "ensure_mock_env_file seeds canonical node count" "${env_contents}" "PULSE_MOCK_NODES=3"
- assert_contains "ensure_mock_env_file seeds canonical vm count" "${env_contents}" "PULSE_MOCK_VMS_PER_NODE=3"
- assert_contains "ensure_mock_env_file seeds canonical lxc count" "${env_contents}" "PULSE_MOCK_LXCS_PER_NODE=3"
- assert_contains "ensure_mock_env_file seeds canonical docker host count" "${env_contents}" "PULSE_MOCK_DOCKER_HOSTS=2"
- assert_contains "ensure_mock_env_file seeds canonical docker container count" "${env_contents}" "PULSE_MOCK_DOCKER_CONTAINERS=5"
- assert_contains "ensure_mock_env_file seeds canonical generic host count" "${env_contents}" "PULSE_MOCK_GENERIC_HOSTS=2"
+ assert_contains "ensure_mock_env_file seeds canonical node count" "${env_contents}" "PULSE_MOCK_NODES=5"
+ assert_contains "ensure_mock_env_file seeds canonical vm count" "${env_contents}" "PULSE_MOCK_VMS_PER_NODE=6"
+ assert_contains "ensure_mock_env_file seeds canonical lxc count" "${env_contents}" "PULSE_MOCK_LXCS_PER_NODE=8"
+ assert_contains "ensure_mock_env_file seeds canonical docker host count" "${env_contents}" "PULSE_MOCK_DOCKER_HOSTS=5"
+ assert_contains "ensure_mock_env_file seeds canonical docker container count" "${env_contents}" "PULSE_MOCK_DOCKER_CONTAINERS=14"
+ assert_contains "ensure_mock_env_file seeds canonical generic host count" "${env_contents}" "PULSE_MOCK_GENERIC_HOSTS=4"
assert_contains "ensure_mock_env_file seeds canonical k8s cluster count" "${env_contents}" "PULSE_MOCK_K8S_CLUSTERS=1"
- assert_contains "ensure_mock_env_file seeds canonical k8s node count" "${env_contents}" "PULSE_MOCK_K8S_NODES=3"
- assert_contains "ensure_mock_env_file seeds canonical k8s pod count" "${env_contents}" "PULSE_MOCK_K8S_PODS=10"
- assert_contains "ensure_mock_env_file seeds canonical k8s deployment count" "${env_contents}" "PULSE_MOCK_K8S_DEPLOYMENTS=4"
+ assert_contains "ensure_mock_env_file seeds canonical k8s node count" "${env_contents}" "PULSE_MOCK_K8S_NODES=5"
+ assert_contains "ensure_mock_env_file seeds canonical k8s pod count" "${env_contents}" "PULSE_MOCK_K8S_PODS=40"
+ assert_contains "ensure_mock_env_file seeds canonical k8s deployment count" "${env_contents}" "PULSE_MOCK_K8S_DEPLOYMENTS=14"
assert_contains "ensure_mock_env_file seeds canonical random metrics flag" "${env_contents}" "PULSE_MOCK_RANDOM_METRICS=true"
assert_contains "ensure_mock_env_file seeds canonical stopped percent" "${env_contents}" "PULSE_MOCK_STOPPED_PERCENT=6"
}
diff --git a/scripts/toggle-mock.sh b/scripts/toggle-mock.sh
index 4c27424399..1401ccfdde 100755
--- a/scripts/toggle-mock.sh
+++ b/scripts/toggle-mock.sh
@@ -224,16 +224,16 @@ load_env_file() {
mock_default_entries() {
cat <<'ENVEOF'
PULSE_MOCK_MODE=false
-PULSE_MOCK_NODES=3
-PULSE_MOCK_VMS_PER_NODE=3
-PULSE_MOCK_LXCS_PER_NODE=3
-PULSE_MOCK_DOCKER_HOSTS=2
-PULSE_MOCK_DOCKER_CONTAINERS=5
-PULSE_MOCK_GENERIC_HOSTS=2
+PULSE_MOCK_NODES=5
+PULSE_MOCK_VMS_PER_NODE=6
+PULSE_MOCK_LXCS_PER_NODE=8
+PULSE_MOCK_DOCKER_HOSTS=5
+PULSE_MOCK_DOCKER_CONTAINERS=14
+PULSE_MOCK_GENERIC_HOSTS=4
PULSE_MOCK_K8S_CLUSTERS=1
-PULSE_MOCK_K8S_NODES=3
-PULSE_MOCK_K8S_PODS=10
-PULSE_MOCK_K8S_DEPLOYMENTS=4
+PULSE_MOCK_K8S_NODES=5
+PULSE_MOCK_K8S_PODS=40
+PULSE_MOCK_K8S_DEPLOYMENTS=14
PULSE_MOCK_RANDOM_METRICS=true
PULSE_MOCK_STOPPED_PERCENT=6
ENVEOF