Panic on SSH agent errors in test
This commit is contained in:
@@ -3,6 +3,8 @@ package examples
|
||||
import (
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"errors"
|
||||
"io/fs"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -24,7 +26,10 @@ func sshagent() string {
|
||||
sock := filepath.Join(dir, "test.sock")
|
||||
|
||||
// In case it already exists.
|
||||
_ = os.Remove(sock)
|
||||
err := os.Remove(sock)
|
||||
if err != nil && !errors.Is(err, fs.ErrNotExist) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
l, err := net.Listen("unix", sock)
|
||||
if err != nil {
|
||||
@@ -32,11 +37,14 @@ func sshagent() string {
|
||||
}
|
||||
|
||||
a := agent.NewKeyring()
|
||||
key, err := rsa.GenerateKey(rand.Reader, 2048)
|
||||
key, err := rsa.GenerateKey(rand.Reader, 4096)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
err = a.Add(agent.AddedKey{PrivateKey: key})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
_ = a.Add(agent.AddedKey{PrivateKey: key})
|
||||
|
||||
go func() {
|
||||
conn, err := l.Accept()
|
||||
|
||||
@@ -415,7 +415,6 @@ func TestImageDiff(t *testing.T) {
|
||||
{
|
||||
name: "no diff if pull=true but no exports",
|
||||
olds: func(_ *testing.T, is ImageState) ImageState {
|
||||
fmt.Println("WHOA NELLY")
|
||||
is.Pull = true
|
||||
return is
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user