update build and composite cache tests
This commit is contained in:
parent
ef692e55f3
commit
782e4916b6
|
|
@ -538,7 +538,7 @@ func Test_stageBuilder_build(t *testing.T) {
|
||||||
filePath := filepath.Join(dir, file)
|
filePath := filepath.Join(dir, file)
|
||||||
ch := NewCompositeCache("", "meow")
|
ch := NewCompositeCache("", "meow")
|
||||||
|
|
||||||
ch.AddPath(filePath)
|
ch.AddPath(filePath, "")
|
||||||
hash, err := ch.Hash()
|
hash, err := ch.Hash()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("couldn't create hash %v", err)
|
t.Errorf("couldn't create hash %v", err)
|
||||||
|
|
@ -570,7 +570,7 @@ func Test_stageBuilder_build(t *testing.T) {
|
||||||
filePath := filepath.Join(dir, file)
|
filePath := filepath.Join(dir, file)
|
||||||
ch := NewCompositeCache("", "meow")
|
ch := NewCompositeCache("", "meow")
|
||||||
|
|
||||||
ch.AddPath(filePath)
|
ch.AddPath(filePath, "")
|
||||||
hash, err := ch.Hash()
|
hash, err := ch.Hash()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("couldn't create hash %v", err)
|
t.Errorf("couldn't create hash %v", err)
|
||||||
|
|
@ -618,7 +618,7 @@ func Test_stageBuilder_build(t *testing.T) {
|
||||||
tarContent := generateTar(t, dir, filename)
|
tarContent := generateTar(t, dir, filename)
|
||||||
|
|
||||||
ch := NewCompositeCache("", "")
|
ch := NewCompositeCache("", "")
|
||||||
ch.AddPath(filepath)
|
ch.AddPath(filepath, "")
|
||||||
|
|
||||||
hash, err := ch.Hash()
|
hash, err := ch.Hash()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -662,7 +662,7 @@ func Test_stageBuilder_build(t *testing.T) {
|
||||||
}
|
}
|
||||||
filePath := filepath.Join(dir, filename)
|
filePath := filepath.Join(dir, filename)
|
||||||
ch := NewCompositeCache("", "")
|
ch := NewCompositeCache("", "")
|
||||||
ch.AddPath(filePath)
|
ch.AddPath(filePath, "")
|
||||||
|
|
||||||
hash, err := ch.Hash()
|
hash, err := ch.Hash()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -713,7 +713,7 @@ func Test_stageBuilder_build(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ch.AddKey(fmt.Sprintf("COPY %s bar.txt", filename))
|
ch.AddKey(fmt.Sprintf("COPY %s bar.txt", filename))
|
||||||
ch.AddPath(filePath)
|
ch.AddPath(filePath, "")
|
||||||
|
|
||||||
hash2, err := ch.Hash()
|
hash2, err := ch.Hash()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -721,7 +721,7 @@ func Test_stageBuilder_build(t *testing.T) {
|
||||||
}
|
}
|
||||||
ch = NewCompositeCache("", fmt.Sprintf("COPY %s foo.txt", filename))
|
ch = NewCompositeCache("", fmt.Sprintf("COPY %s foo.txt", filename))
|
||||||
ch.AddKey(fmt.Sprintf("COPY %s bar.txt", filename))
|
ch.AddKey(fmt.Sprintf("COPY %s bar.txt", filename))
|
||||||
ch.AddPath(filePath)
|
ch.AddPath(filePath, "")
|
||||||
|
|
||||||
image := fakeImage{
|
image := fakeImage{
|
||||||
ImageLayers: []v1.Layer{
|
ImageLayers: []v1.Layer{
|
||||||
|
|
@ -777,14 +777,14 @@ COPY %s bar.txt
|
||||||
}
|
}
|
||||||
filePath := filepath.Join(dir, filename)
|
filePath := filepath.Join(dir, filename)
|
||||||
ch := NewCompositeCache("", fmt.Sprintf("COPY %s foo.txt", filename))
|
ch := NewCompositeCache("", fmt.Sprintf("COPY %s foo.txt", filename))
|
||||||
ch.AddPath(filePath)
|
ch.AddPath(filePath, "")
|
||||||
|
|
||||||
hash1, err := ch.Hash()
|
hash1, err := ch.Hash()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("couldn't create hash %v", err)
|
t.Errorf("couldn't create hash %v", err)
|
||||||
}
|
}
|
||||||
ch.AddKey(fmt.Sprintf("COPY %s bar.txt", filename))
|
ch.AddKey(fmt.Sprintf("COPY %s bar.txt", filename))
|
||||||
ch.AddPath(filePath)
|
ch.AddPath(filePath, "")
|
||||||
|
|
||||||
hash2, err := ch.Hash()
|
hash2, err := ch.Hash()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -792,7 +792,7 @@ COPY %s bar.txt
|
||||||
}
|
}
|
||||||
ch = NewCompositeCache("", fmt.Sprintf("COPY %s foo.txt", filename))
|
ch = NewCompositeCache("", fmt.Sprintf("COPY %s foo.txt", filename))
|
||||||
ch.AddKey(fmt.Sprintf("COPY %s bar.txt", filename))
|
ch.AddKey(fmt.Sprintf("COPY %s bar.txt", filename))
|
||||||
ch.AddPath(filePath)
|
ch.AddPath(filePath, "")
|
||||||
|
|
||||||
image := fakeImage{
|
image := fakeImage{
|
||||||
ImageLayers: []v1.Layer{
|
ImageLayers: []v1.Layer{
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ func Test_CompositeCache_AddPath_dir(t *testing.T) {
|
||||||
|
|
||||||
fn := func() string {
|
fn := func() string {
|
||||||
r := NewCompositeCache()
|
r := NewCompositeCache()
|
||||||
if err := r.AddPath(tmpDir); err != nil {
|
if err := r.AddPath(tmpDir, ""); err != nil {
|
||||||
t.Errorf("expected error to be nil but was %v", err)
|
t.Errorf("expected error to be nil but was %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -118,7 +118,7 @@ func Test_CompositeCache_AddPath_file(t *testing.T) {
|
||||||
p := tmpfile.Name()
|
p := tmpfile.Name()
|
||||||
fn := func() string {
|
fn := func() string {
|
||||||
r := NewCompositeCache()
|
r := NewCompositeCache()
|
||||||
if err := r.AddPath(p); err != nil {
|
if err := r.AddPath(p, ""); err != nil {
|
||||||
t.Errorf("expected error to be nil but was %v", err)
|
t.Errorf("expected error to be nil but was %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue