Skip to content

Commit 8d7f6e9

Browse files
authored
fix(dir): use version v0.1.4 of directory and update test to support new extensions (#24)
Signed-off-by: Peter Balogh <p.balogh.sa@gmail.com>
1 parent ada478a commit 8d7f6e9

File tree

5 files changed

+30
-23
lines changed

5 files changed

+30
-23
lines changed

integrations/Taskfile.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ vars:
1212
## Image config
1313
IMAGE_REPO: '{{ .IMAGE_REPO | default "ghcr.io/agntcy" }}'
1414
GATEWAY_IMAGE_TAG: '{{ .GATEWAY_IMAGE_TAG | default "0.3.2" }}'
15-
DIRECTORY_IMAGE_TAG: '{{ .DIRECTORY_IMAGE_TAG | default "v0.1.2" }}'
15+
DIRECTORY_IMAGE_TAG: '{{ .DIRECTORY_IMAGE_TAG | default "v0.1.4" }}'
1616

1717
IMAGE_BAKE_OPTS: '{{ .IMAGE_BAKE_OPTS | default "--set *.platform=linux/arm64" }}'
1818
TEST_APP_TAG: '{{ .TEST_APP_TAG | default "v0.0.2" }}'

integrations/agntcy-dir/components/helm/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ appVersion: "0.1.0"
2828

2929
dependencies:
3030
- name: dir
31-
version: "v0.1.2"
31+
version: "v0.1.4"
3232
repository: oci://ghcr.io/agntcy/dir/helm-charts
Submodule dir updated 139 files

integrations/agntcy-dir/tests/compiler_test.go

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"os"
1010
"path/filepath"
1111

12+
"github.com/google/go-cmp/cmp"
1213
ginkgo "github.com/onsi/ginkgo/v2"
1314
"github.com/onsi/gomega"
1415

@@ -21,37 +22,31 @@ var _ = ginkgo.Describe("Agntcy compiler tests", func() {
2122
dockerImage string
2223
mountDest string
2324
mountString string
25+
modelConfigFilePath string
2426
expectedAgentModelFile string
2527
)
2628

2729
ginkgo.BeforeEach(func() {
2830
examplesDir := "../examples/"
29-
marketingStrategyPath, err := filepath.Abs(filepath.Join(examplesDir, "dir/e2e/testdata/marketing-strategy"))
31+
testDataPath, err := filepath.Abs(filepath.Join(examplesDir, "dir/e2e/testdata"))
3032
gomega.Expect(err).NotTo(gomega.HaveOccurred())
3133

3234
tempAgentPath = filepath.Join(os.TempDir(), "agent.json")
3335
dockerImage = fmt.Sprintf("%s/dir-ctl:%s", os.Getenv("IMAGE_REPO"), os.Getenv("DIRECTORY_IMAGE_TAG"))
34-
mountDest = "/opt/marketing-strategy"
35-
mountString = fmt.Sprintf("%s:%s", marketingStrategyPath, mountDest)
36+
mountDest = "/testdata"
37+
mountString = fmt.Sprintf("%s:%s", testDataPath, mountDest)
3638

37-
testdataDir, err := filepath.Abs(filepath.Join(examplesDir, "testdata"))
38-
gomega.Expect(err).NotTo(gomega.HaveOccurred())
39-
40-
expectedAgentModelFile = filepath.Join(testdataDir, "expected_agent.json")
39+
modelConfigFilePath = filepath.Join(mountDest, "build.config.yaml")
40+
expectedAgentModelFile = filepath.Join(testDataPath, "agent.json")
4141
})
4242

4343
ginkgo.Context("agent compilation", func() {
4444
ginkgo.It("should compile an agent", func() {
4545

4646
dirctlArgs := []string{
4747
"build",
48-
"--name=marketing-strategy",
49-
"--version=v1.0.0",
50-
"--created-at=2025-01-01T00:00:00Z",
51-
"--artifact-type=python-package",
52-
"--artifact-url=http://ghcr.io/agntcy/marketing-strategy",
53-
"--author=author1",
54-
"--author=author2",
48+
"--config",
49+
modelConfigFilePath,
5550
mountDest,
5651
}
5752

@@ -80,8 +75,20 @@ var _ = ginkgo.Describe("Agntcy compiler tests", func() {
8075
err = json.Unmarshal([]byte(compiledModelJSON), &compiled)
8176
gomega.Expect(err).NotTo(gomega.HaveOccurred())
8277

83-
// Check the compiled agent model without extensions field
84-
gomega.Expect(expected).To(gomega.BeComparableTo(compiled))
78+
// Filter "created_at" field
79+
filter := cmp.FilterPath(func(p cmp.Path) bool {
80+
// Ensure the path is deep enough
81+
if len(p) >= 3 {
82+
if mapStep, ok := p[len(p)-3].(cmp.MapIndex); ok {
83+
if key, ok := mapStep.Key().Interface().(string); ok && key == "created_at" {
84+
return true // Ignore these paths
85+
}
86+
}
87+
}
88+
return false // Include all other paths
89+
}, cmp.Ignore())
90+
91+
gomega.Expect(expected).To(gomega.BeComparableTo(compiled, filter))
8592
})
8693
})
8794
})

integrations/agntcy-dir/tests/push_agent_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ var _ = ginkgo.Describe("Agntcy agent push tests", func() {
2727

2828
ginkgo.BeforeEach(func() {
2929
examplesDir := "../examples/"
30-
testDataDir, err := filepath.Abs(filepath.Join(examplesDir, "testdata"))
30+
testDataPath, err := filepath.Abs(filepath.Join(examplesDir, "dir/e2e/testdata"))
3131
gomega.Expect(err).NotTo(gomega.HaveOccurred())
3232

3333
dockerImage = fmt.Sprintf("%s/dir-ctl:%s", os.Getenv("IMAGE_REPO"), os.Getenv("DIRECTORY_IMAGE_TAG"))
34-
mountDest = "/opt/testdata"
35-
mountString = fmt.Sprintf("%s:%s", testDataDir, mountDest)
34+
mountDest = "/testdata"
35+
mountString = fmt.Sprintf("%s:%s", testDataPath, mountDest)
3636

37-
agentModelFile = filepath.Join(mountDest, "expected_agent.json")
37+
agentModelFile = filepath.Join(mountDest, "agent.json")
3838
})
3939

4040
ginkgo.Context("agent push and pull", func() {

0 commit comments

Comments
 (0)