(t *testing.T)
| 131 | } |
| 132 | |
| 133 | func TestManagerGetAllInstances(t *testing.T) { |
| 134 | tmpDir := t.TempDir() |
| 135 | prd1Path := createTestPRDWithName(t, tmpDir, "prd1") |
| 136 | prd2Path := createTestPRDWithName(t, tmpDir, "prd2") |
| 137 | prd3Path := createTestPRDWithName(t, tmpDir, "prd3") |
| 138 | |
| 139 | m := NewManager(10, testProvider) |
| 140 | m.Register("prd1", prd1Path) |
| 141 | m.Register("prd2", prd2Path) |
| 142 | m.Register("prd3", prd3Path) |
| 143 | |
| 144 | instances := m.GetAllInstances() |
| 145 | if len(instances) != 3 { |
| 146 | t.Errorf("expected 3 instances, got %d", len(instances)) |
| 147 | } |
| 148 | |
| 149 | // Check all names are present |
| 150 | names := make(map[string]bool) |
| 151 | for _, inst := range instances { |
| 152 | names[inst.Name] = true |
| 153 | } |
| 154 | for _, name := range []string{"prd1", "prd2", "prd3"} { |
| 155 | if !names[name] { |
| 156 | t.Errorf("expected %s in instances", name) |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | func TestManagerGetRunningPRDs(t *testing.T) { |
| 162 | m := NewManager(10, testProvider) |
nothing calls this directly
no test coverage detected