Skip to content

Commit

Permalink
[#222] Deployment only out of .json files (#245)
Browse files Browse the repository at this point in the history
[#222] Deployment only out of .json files

Signed-off-by: Anish Vallolikalathil Achuthadas <[email protected]>
  • Loading branch information
AnishVallolikalathilAchuthadas authored Jun 18, 2024
1 parent 4b2cd25 commit 121a570
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion containerm/deployment/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"io/fs"
"os"
"path/filepath"
"strings"
"sync"

"github.com/eclipse-kanto/container-management/containerm/containers/types"
Expand Down Expand Up @@ -87,7 +88,7 @@ func (d *deploymentMgr) Deploy(ctx context.Context) error {
if err != nil {
return err
}
if !entry.IsDir() {
if !entry.IsDir() && strings.HasSuffix(path, ".json") {
ctr, readErr := util.ReadContainer(path)
if readErr != nil {
log.ErrorErr(readErr, "error reading container configuration from file = %s", path)
Expand Down
7 changes: 7 additions & 0 deletions containerm/deployment/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ func TestDeployCommon(t *testing.T) {
return nil
},
},
"test_deploy_ignore_non_json_files": {
ctrPath: filepath.Join(baseCtrJSONPath, "non_json_files"),
mockExec: func(mockMgr *mocks.MockContainerManager) error {
mockMgr.EXPECT().List(testContext).Return(nil, nil).Times(2)
return nil
},
},
}

// execute tests
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file is for testing purpose of non json files

0 comments on commit 121a570

Please sign in to comment.