Skip to content

Commit 7a8ad44

Browse files
committed
refactor: remove obsolete YAML test files and clean up validator tests
1 parent def6889 commit 7a8ad44

File tree

10 files changed

+21
-77
lines changed

10 files changed

+21
-77
lines changed

internal/orchestrator/app/testdata/validator/all-required-app.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

internal/orchestrator/app/testdata/validator/bricks-list.yaml

Lines changed: 0 additions & 9 deletions
This file was deleted.

internal/orchestrator/app/testdata/validator/empty-bricks-app.yaml

Lines changed: 0 additions & 4 deletions
This file was deleted.

internal/orchestrator/app/testdata/validator/empty-required-app.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

internal/orchestrator/app/testdata/validator/no-bricks-app.yaml

Lines changed: 0 additions & 2 deletions
This file was deleted.

internal/orchestrator/app/testdata/validator/not-found-brick-app.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

internal/orchestrator/app/testdata/validator/not-found-variable-app.yaml

Lines changed: 0 additions & 8 deletions
This file was deleted.

internal/orchestrator/app/testdata/validator/omitted-mixed-required-app.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

internal/orchestrator/app/testdata/validator/omitted-required-app.yaml

Lines changed: 0 additions & 4 deletions
This file was deleted.

internal/orchestrator/app/validator_test.go

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package app
33
import (
44
"errors"
55
"os"
6-
"path/filepath"
7-
"strings"
86
"testing"
97

108
"github.com/stretchr/testify/assert"
@@ -16,9 +14,27 @@ import (
1614
)
1715

1816
func TestValidateAppDescriptorBricks(t *testing.T) {
19-
bricksIndex, err := bricksindex.GenerateBricksIndexFromFile(paths.New("testdata/validator"))
20-
require.NoError(t, err)
21-
require.NotNil(t, bricksIndex)
17+
bricksIndex := &bricksindex.BricksIndex{
18+
Bricks: []bricksindex.Brick{
19+
{
20+
ID: "arduino:arduino_cloud",
21+
Name: "Arduino Cloud",
22+
Description: "Connects to Arduino Cloud",
23+
Variables: []bricksindex.BrickVariable{
24+
{
25+
Name: "ARDUINO_DEVICE_ID",
26+
Description: "Arduino Cloud Device ID",
27+
DefaultValue: "", // Required (no default value)
28+
},
29+
{
30+
Name: "ARDUINO_SECRET",
31+
Description: "Arduino Cloud Secret",
32+
DefaultValue: "", // Required (no default value)
33+
},
34+
},
35+
},
36+
},
37+
}
2238

2339
testCases := []struct {
2440
name string
@@ -146,21 +162,3 @@ bricks:
146162
})
147163
}
148164
}
149-
150-
func writeYAMLToTempFile(t *testing.T, yamlContent string) *paths.Path {
151-
// Create a temporary directory
152-
tempDir, err := os.MkdirTemp("", "validator_test_*")
153-
require.NoError(t, err)
154-
155-
// Clean up the temporary directory after the test
156-
t.Cleanup(func() {
157-
os.RemoveAll(tempDir)
158-
})
159-
160-
// Write YAML content to a temporary file
161-
yamlFile := filepath.Join(tempDir, "app.yaml")
162-
err = os.WriteFile(yamlFile, []byte(strings.TrimSpace(yamlContent)), 0644)
163-
require.NoError(t, err)
164-
165-
return paths.New(yamlFile)
166-
}

0 commit comments

Comments
 (0)