Skip to content

Commit

Permalink
Merge branch 'main' into fix/add_openssh
Browse files Browse the repository at this point in the history
  • Loading branch information
HarikrishnanBalagopal committed Jan 29, 2024
2 parents 383bfd6 + 3fd2033 commit 9563543
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
GO_VERSION ?= $(shell go run ./scripts/detectgoversion/detect.go 2>/dev/null || printf '1.18')
BINNAME ?= move2kube
IN_CICD ?= false
CGO_ENABLED ?= 0
BINDIR := $(CURDIR)/bin
DISTDIR := $(CURDIR)/_dist
TARGETS := darwin/amd64 darwin/arm64 linux/amd64 linux/arm64 linux/s390x linux/ppc64le windows/amd64
Expand Down Expand Up @@ -102,7 +103,7 @@ build: get $(BINDIR)/$(BINNAME) ## Build go code
@printf "\033[32m-------------------------------------\n BUILD SUCCESS\n-------------------------------------\033[0m\n"

$(BINDIR)/$(BINNAME): $(SRC) $(ASSETS) $(WEB_ASSETS)
CGO_ENABLED=0 go build -ldflags '$(LDFLAGS)' -o $(BINDIR)/$(BINNAME) .
CGO_ENABLED=$(CGO_ENABLED) go build -ldflags '$(LDFLAGS)' -o $(BINDIR)/$(BINNAME) .
mkdir -p $(GOPATH)/bin/
cp $(BINDIR)/$(BINNAME) $(GOPATH)/bin/

Expand Down
7 changes: 7 additions & 0 deletions OWNERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Maintainers

* Akash Nayak ([Akash-Nayak](https://github.com/Akash-Nayak))
* Ashok Pon Kumar Sree Prakash ([ashokponkumar](https://github.com/ashokponkumar))
* Harikrishnan Balagopal ([HarikrishnanBalagopal](https://github.com/HarikrishnanBalagopal))
* Mehant Kammakomati ([kmehant](https://github.com/kmehant))
* Padmanabha Venkatagiri Seshadri ([seshapad](https://github.com/seshapad))
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Move2Kube is a command-line tool that accelerates the process of re-platforming

## Installation

### Using install script
### Using the install script

To install the latest stable version:

Expand All @@ -32,13 +32,28 @@ To install the bleeding edge version:
BLEEDING_EDGE='true' bash <(curl https://raw.githubusercontent.com/konveyor/move2kube/main/scripts/install.sh)
```

### Uninstall CLI installed via the install script

Simply remove the binary

```shell
rm /usr/local/bin/move2kube
```

### Using Homebrew

```shell
brew tap konveyor/move2kube
brew install move2kube
```

### Uninstall CLI installed via Homebrew

```shell
brew uninstall move2kube
brew untap konveyor/move2kube
```

## UI

To bring up UI version:
Expand Down
57 changes: 51 additions & 6 deletions filesystem/merger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
package filesystem

import (
"io/ioutil"
"os"
"testing"
"io/ioutil"
)

func TestMergeDeletionCallBack(t *testing.T) {
Expand All @@ -40,13 +40,59 @@ func TestMergeDeletionCallBack(t *testing.T) {
t.Fatalf("Expected source file to not exist, but got error: %v", err)
}


_, destErr := os.Stat(destination)
if !os.IsNotExist(destErr) {
t.Error("Expected destination directory not to exist, but it exists")
}


})
t.Run("test for scenario which checks for permissions of the destination directory to match the permissions of the source file when both the source file and destination directory exist", func(t *testing.T) {
sourceDir, err := ioutil.TempDir("", "sourceDir")
if err != nil {
t.Fatalf("Failed to create source directory: %v", err)
}
defer os.RemoveAll(sourceDir)

// Create a temporary file within the source directory
sourceFile, err := ioutil.TempFile(sourceDir, "sourceFile.txt")
if err != nil {
t.Fatalf("Failed to create source file: %v", err)
}
defer os.Remove(sourceFile.Name())

// Create a temporary destination directory
destinationDir, err := ioutil.TempDir("", "destinationDir")
if err != nil {
t.Fatalf("Failed to create destination directory: %v", err)
}
defer os.RemoveAll(destinationDir)

// Call the mergedeletion callback function
err = mergeDeletionCallBack(sourceFile.Name(), destinationDir, nil)
if err != nil {
t.Fatalf("Unexpected error during merge: %v", err)
}

// Check if the destination directory exists
destInfo, destErr := os.Stat(destinationDir)
if destErr != nil {
t.Fatalf("Failed to get destination directory info: %v", destErr)
}

// Checking if the destination is indeed a directory or not
if !destInfo.IsDir() {
t.Fatalf("Expected destination to be a directory but it is not.")
}

// Check if the destination directory permissions match the source file
sourceFileInfo, sourceFileErr := os.Stat(sourceFile.Name())
if sourceFileErr != nil {
t.Fatalf("Failed to get source file info: %v", sourceFileErr)
}

if destInfo.Mode().Perm() != sourceFileInfo.Mode().Perm() {
t.Errorf("Expected destination directory permissions to be %s, but got %s", sourceFileInfo.Mode().Perm(), destInfo.Mode().Perm())
}
})
}

Expand All @@ -60,7 +106,7 @@ func TestMergeProcessFileCallBack_SameContent(t *testing.T) {
}
defer os.Remove(sourceFile.Name())

destinationFile, err := ioutil.TempFile(nonExistentPath , "destination")
destinationFile, err := ioutil.TempFile(nonExistentPath, "destination")
if err != nil {
t.Fatalf("Failed to create destination file: %v", err)
}
Expand All @@ -77,7 +123,6 @@ func TestMergeProcessFileCallBack_SameContent(t *testing.T) {
t.Fatalf("Failed to write to destination file: %v", err)
}


err = mergeProcessFileCallBack(sourceFile.Name(), destinationFile.Name(), false)
if err != nil {
t.Fatalf("Unexpected error: %v", err)
Expand All @@ -92,4 +137,4 @@ func TestMergeProcessFileCallBack_SameContent(t *testing.T) {
t.Errorf("Destination file content should not be updated")
}
})
}
}

0 comments on commit 9563543

Please sign in to comment.