Skip to content

Commit d8797ef

Browse files
author
github-actions
committed
Merge branch 'main' into cras
2 parents ad95f5f + 0813f99 commit d8797ef

File tree

6 files changed

+21
-44
lines changed

6 files changed

+21
-44
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ orbs:
66
parameters:
77
go-version:
88
type: string
9-
default: '1.23.4'
9+
default: '1.23.5'
1010

1111
executors:
1212
node:

INSTALL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ _**NOTE:** if you are updating Go from a older version, make sure you remove
143143
`/usr/local/go` before reinstalling it._
144144

145145
```sh
146-
export VERSION=1.23.4 OS=linux ARCH=amd64 # change this as you need
146+
export VERSION=1.23.5 OS=linux ARCH=amd64 # change this as you need
147147

148148
wget -O /tmp/go${VERSION}.${OS}-${ARCH}.tar.gz \
149149
https://dl.google.com/go/go${VERSION}.${OS}-${ARCH}.tar.gz

internal/pkg/util/fs/files/passwd_test.go

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
package files
77

88
import (
9+
"fmt"
910
"os"
11+
"os/user"
1012
"path/filepath"
13+
"strings"
1114
"testing"
1215

1316
"github.com/sylabs/singularity/v4/internal/pkg/test"
14-
"gotest.tools/v3/golden"
1517
)
1618

1719
func TestPasswd(t *testing.T) {
@@ -26,29 +28,33 @@ func TestPasswd(t *testing.T) {
2628
t.Errorf("should have failed with bad passwd file")
2729
}
2830

29-
// Test how Passwd() works with an empty file
31+
// Adding current user to an empty file
3032
f, err := os.CreateTemp("", "empty-passwd-")
3133
if err != nil {
32-
t.Error(err)
34+
t.Fatal(err)
3335
}
3436
emptyPasswd := f.Name()
3537
defer os.Remove(emptyPasswd)
3638
f.Close()
3739

3840
_, err = Passwd(emptyPasswd, "/home", uid, nil)
3941
if err != nil {
40-
t.Error(err)
42+
t.Fatalf("Unexpected error in Passwd() when adding uid %d: %v", uid, err)
4143
}
4244

45+
// Modifying root user in test file
4346
inputPasswdFilePath := filepath.Join(".", "testdata", "passwd.in")
44-
testUID := 0
45-
testHomeDir := "/tmp"
46-
testGoldenFile := "passwd.root.customhome.golden"
47-
bytes, err := Passwd(inputPasswdFilePath, testHomeDir, testUID, nil)
47+
outputPasswd, err := Passwd(inputPasswdFilePath, "/tmp", 0, nil)
4848
if err != nil {
49-
t.Errorf("Unexpected error encountered calling Passwd(): %v", err)
50-
return
49+
t.Fatalf("Unexpected error in Passwd() when modifying root entry: %v", err)
5150
}
5251

53-
golden.Assert(t, string(bytes), testGoldenFile, "mismatch in Passwd() invocation (uid: %d; requested homeDir: %#v)", testUID, testHomeDir)
52+
rootUser, err := user.Lookup("root")
53+
if err != nil {
54+
t.Fatal(err)
55+
}
56+
expectRootEntry := fmt.Sprintf("root:x:0:0:%s:/tmp:/bin/ash\n", rootUser.Name)
57+
if !strings.HasPrefix(string(outputPasswd), expectRootEntry) {
58+
t.Errorf("Expected root entry %q, not found in:\n%s", expectRootEntry, string(outputPasswd))
59+
}
5460
}

internal/pkg/util/fs/files/testdata/passwd.root.customhome.golden

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)