This repository has been archived by the owner on Dec 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from deliveroo/LOG-1772/canoe-productionise-paddle
LOG-1772: Canoe: productionise Paddle
- Loading branch information
Showing
11 changed files
with
288 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
tmp | ||
dist | ||
paddle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package data | ||
|
||
import ( | ||
"github.com/spf13/afero" | ||
"reflect" | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func TestFilesToKeys(t *testing.T) { | ||
AppFs = afero.NewMemMapFs() | ||
AppFs.MkdirAll("src/a", 0755) | ||
afero.WriteFile(AppFs, "src/a/b", []byte("file c"), 0644) | ||
afero.WriteFile(AppFs, "src/c", []byte("file c"), 0644) | ||
|
||
list := filesToKeys("src") | ||
expectation := []string{ | ||
"src/a/b", | ||
"src/c", | ||
} | ||
|
||
if !reflect.DeepEqual(list, expectation) { | ||
t.Errorf("list is different got: %s, want: %s.", strings.Join(list, ","), strings.Join(expectation, ",")) | ||
} | ||
} | ||
|
||
func TestFilesToKeysWhenEmptyFolder(t *testing.T) { | ||
AppFs = afero.NewMemMapFs() | ||
AppFs.MkdirAll("src", 0755) | ||
|
||
list := filesToKeys("src") | ||
|
||
if len(list) != 0 { | ||
t.Errorf("expecting empty list but got: %s", strings.Join(list, ",")) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package data | ||
|
||
import ( | ||
"strings" | ||
) | ||
|
||
type S3Path struct { | ||
bucket string | ||
path string | ||
} | ||
|
||
func (p *S3Path) Basename() string { | ||
components := strings.Split(p.path, "/") | ||
return components[len(components)-1] | ||
} | ||
|
||
func (p *S3Path) Dirname() string { | ||
components := strings.Split(p.path, "/") | ||
if len(components) == 0 { | ||
return "" | ||
} | ||
return strings.Join(components[:len(components)-1], "/") | ||
} |
Oops, something went wrong.