Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,52 +407,3 @@ func pathContains(root, candidate string) bool {
}
return rel == "." || (rel != ".." && !strings.HasPrefix(rel, ".."+string(filepath.Separator)))
}

// removeProjectConfig removes a project from the configuration
// Keeping for future use when we add a 'remove' or 'clean' command
//
//nolint:unused // kept for future 'orchcli remove' command implementation
func removeProjectConfig(projectPath string) error {
configPath, err := GetConfigPath()
if err != nil {
return err
}

// Use file locking for concurrent access
lockPath := configPath + ".lock"
fileLock := flock.New(lockPath)

// Try to acquire lock
err = fileLock.Lock()
if err != nil {
return fmt.Errorf("failed to acquire config lock: %w", err)
}
defer func() {
_ = fileLock.Unlock()
}()

// Load current config
config, err := LoadConfig()
if err != nil {
return err
}

// Remove project
delete(config.Projects, projectPath)

if config.CurrentProject == projectPath {
config.CurrentProject = ""
}

// Marshal and save
data, err := json.MarshalIndent(config, "", " ")
if err != nil {
return fmt.Errorf("failed to marshal config: %w", err)
}

if err := writeFileAtomically(configPath, data, configFilePerm); err != nil {
return fmt.Errorf("failed to write config: %w", err)
}

return nil
}
7 changes: 0 additions & 7 deletions npm/index.js

This file was deleted.

20 changes: 0 additions & 20 deletions npm/scripts/prepack.js

This file was deleted.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
"name": "@kubeorch/cli",
"version": "0.0.3",
"description": "OrchCLI - KubeOrch Developer CLI",
"main": "npm/index.js",
"bin": {
"orchcli": "./npm/bin/orchcli"
},
"scripts": {
"postinstall": "node npm/scripts/postinstall.js",
"prepack": "node npm/scripts/prepack.js",
"test": "echo \"Tests are run via Go test suite\" && exit 0"
},
"repository": {
Expand Down
79 changes: 0 additions & 79 deletions test/docker-install-test.sh

This file was deleted.

27 changes: 0 additions & 27 deletions tests/helpers/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
package helpers

import (
"io"
"os"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -61,32 +60,6 @@ func (h *TestHelper) ReadFile(path string) string {
return string(content)
}

// CaptureOutput captures stdout and stderr
func CaptureOutput(f func()) (string, string, error) {
oldStdout := os.Stdout
oldStderr := os.Stderr

rOut, wOut, _ := os.Pipe()
rErr, wErr, _ := os.Pipe()

os.Stdout = wOut
os.Stderr = wErr

// Run the function
f()

// Restore
wOut.Close()
wErr.Close()
os.Stdout = oldStdout
os.Stderr = oldStderr

stdout, _ := io.ReadAll(rOut)
stderr, _ := io.ReadAll(rErr)

return string(stdout), string(stderr), nil
}

// Cleanup performs cleanup operations
func (h *TestHelper) Cleanup() {
if h.TempDir != "" {
Expand Down
50 changes: 0 additions & 50 deletions tests/mocks/exec_mock.go

This file was deleted.

47 changes: 0 additions & 47 deletions tests/unit/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,53 +96,6 @@ func (suite *UtilsTestSuite) TestGetComposeFile() {
}
}

func (suite *UtilsTestSuite) TestValidateDockerCompose() {
// Test Docker Compose validation
// This would mock the docker compose check

// Mock successful validation
mockCmd := func() error {
return nil
}

err := mockCmd()
assert.NoError(suite.T(), err)

// Mock failed validation
mockFailCmd := func() error {
return assert.AnError
}

err = mockFailCmd()
assert.Error(suite.T(), err)
}

func (suite *UtilsTestSuite) TestJoinArgs() {
// Test argument joining for shell commands
testCases := []struct {
expected string
args []string
}{
{
expected: "arg1 arg2",
args: []string{"arg1", "arg2"},
},
{
expected: "'arg with spaces' arg2",
args: []string{"arg with spaces", "arg2"},
},
{
expected: "'arg'\"'\"'with'\"'\"'quotes' arg2",
args: []string{"arg'with'quotes", "arg2"},
},
}

for _, tc := range testCases {
// This would test the actual joinArgs function
assert.NotEmpty(suite.T(), tc.expected)
}
}

func TestUtilsTestSuite(t *testing.T) {
suite.Run(t, new(UtilsTestSuite))
}
Loading