You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-11-23 21:44:44 +02:00
Move cncd/pipeline/pipeline/ to pipeline/ (#347)
* Refactor: move cncd/pipeline/ to pipeline/ * Refactor: move pipeline/pipeline/ to pipeline/
This commit is contained in:
74
pipeline/backend/docker/convert_test.go
Normal file
74
pipeline/backend/docker/convert_test.go
Normal file
@@ -0,0 +1,74 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSplitVolumeParts(t *testing.T) {
|
||||
testdata := []struct {
|
||||
from string
|
||||
to []string
|
||||
success bool
|
||||
}{
|
||||
{
|
||||
from: `Z::Z::rw`,
|
||||
to: []string{`Z:`, `Z:`, `rw`},
|
||||
success: true,
|
||||
},
|
||||
{
|
||||
from: `Z:\:Z:\:rw`,
|
||||
to: []string{`Z:\`, `Z:\`, `rw`},
|
||||
success: true,
|
||||
},
|
||||
{
|
||||
from: `Z:\git\refs:Z:\git\refs:rw`,
|
||||
to: []string{`Z:\git\refs`, `Z:\git\refs`, `rw`},
|
||||
success: true,
|
||||
},
|
||||
{
|
||||
from: `Z:\git\refs:Z:\git\refs`,
|
||||
to: []string{`Z:\git\refs`, `Z:\git\refs`},
|
||||
success: true,
|
||||
},
|
||||
{
|
||||
from: `Z:/:Z:/:rw`,
|
||||
to: []string{`Z:/`, `Z:/`, `rw`},
|
||||
success: true,
|
||||
},
|
||||
{
|
||||
from: `Z:/git/refs:Z:/git/refs:rw`,
|
||||
to: []string{`Z:/git/refs`, `Z:/git/refs`, `rw`},
|
||||
success: true,
|
||||
},
|
||||
{
|
||||
from: `Z:/git/refs:Z:/git/refs`,
|
||||
to: []string{`Z:/git/refs`, `Z:/git/refs`},
|
||||
success: true,
|
||||
},
|
||||
{
|
||||
from: `/test:/test`,
|
||||
to: []string{`/test`, `/test`},
|
||||
success: true,
|
||||
},
|
||||
{
|
||||
from: `test:/test`,
|
||||
to: []string{`test`, `/test`},
|
||||
success: true,
|
||||
},
|
||||
{
|
||||
from: `test:test`,
|
||||
to: []string{`test`, `test`},
|
||||
success: true,
|
||||
},
|
||||
}
|
||||
for _, test := range testdata {
|
||||
results, err := splitVolumeParts(test.from)
|
||||
if test.success == (err != nil) {
|
||||
} else {
|
||||
if reflect.DeepEqual(results, test.to) != test.success {
|
||||
t.Errorf("Expect %q matches %q is %v", test.from, results, test.to)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user