(t *testing.T)
| 119 | } |
| 120 | |
| 121 | func TestLoadProject_ServiceSelection(t *testing.T) { |
| 122 | tmpDir := t.TempDir() |
| 123 | composeFile := filepath.Join(tmpDir, "compose.yaml") |
| 124 | composeContent := ` |
| 125 | services: |
| 126 | web: |
| 127 | image: nginx:latest |
| 128 | db: |
| 129 | image: postgres:latest |
| 130 | cache: |
| 131 | image: redis:latest |
| 132 | ` |
| 133 | err := os.WriteFile(composeFile, []byte(composeContent), 0o644) |
| 134 | assert.NilError(t, err) |
| 135 | |
| 136 | service, err := NewComposeService(nil) |
| 137 | assert.NilError(t, err) |
| 138 | |
| 139 | // Load only specific services |
| 140 | project, err := service.LoadProject(t.Context(), api.ProjectLoadOptions{ |
| 141 | ConfigPaths: []string{composeFile}, |
| 142 | Services: []string{"web", "db"}, |
| 143 | }) |
| 144 | |
| 145 | assert.NilError(t, err) |
| 146 | assert.Check(t, is.Len(project.Services, 2)) |
| 147 | assert.Check(t, is.Contains(project.Services, "web")) |
| 148 | assert.Check(t, is.Contains(project.Services, "db")) |
| 149 | assert.Check(t, !is.Contains(project.Services, "cache")().Success()) |
| 150 | } |
| 151 | |
| 152 | func TestLoadProject_WithProfiles(t *testing.T) { |
| 153 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected