Skip to content

Commit

Permalink
chore(cmd): unify assert parameters
Browse files Browse the repository at this point in the history
- fix order of parameters to match expected and actual

Signed-off-by: AtomicFS <[email protected]>
  • Loading branch information
AtomicFS committed Jan 20, 2025
1 parent 23c8d31 commit b086942
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cmd/firmware-action/filesystem/filesystem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func TestLastSaveRunTime(t *testing.T) {
// Load - should fallback because no file exists, but no error
loadTime, err := LoadLastRunTime(pathTimeFile)
assert.NoError(t, err)
assert.Equal(t, loadTime, time.Time{})
assert.Equal(t, time.Time{}, loadTime)
assert.ErrorIs(t, CheckFileExists(pathTimeFile), os.ErrNotExist)

// Save
Expand All @@ -133,7 +133,7 @@ func TestGetFileModTime(t *testing.T) {
// Missing file - should fail
modTime, err := GetFileModTime(pathFile)
assert.ErrorIs(t, err, os.ErrNotExist)
assert.Equal(t, modTime, time.Time{})
assert.Equal(t, time.Time{}, modTime)
assert.ErrorIs(t, CheckFileExists(pathFile), os.ErrNotExist)

// Make file
Expand Down
4 changes: 2 additions & 2 deletions cmd/firmware-action/filesystem/git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestGitRun(t *testing.T) {
// Test git status
stdout, err := gitRun("./", []string{"git", "status"})
assert.NoError(t, err)
assert.Equal(t, stdout, "On branch master\nnothing to commit, working tree clean\n")
assert.Equal(t, "On branch master\nnothing to commit, working tree clean\n", stdout)
}

func TestGitDescribeCoreboot(t *testing.T) {
Expand All @@ -73,7 +73,7 @@ func TestGitDescribeCoreboot(t *testing.T) {
// Test git status
describe, err := GitDescribeCoreboot("./")
assert.NoError(t, err)
assert.Equal(t, describe, "4eeb1eaf0c81")
assert.Equal(t, "4eeb1eaf0c81", describe)
// This magic value comes from manual execution of the test
// Since the content, author and time of the commit are hard-coded,
// the commit hash is always the same
Expand Down
6 changes: 4 additions & 2 deletions cmd/firmware-action/recipes/linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,10 @@ func TestLinux(t *testing.T) {
assert.ErrorIs(t, err, tc.wantErr)

// Check artifacts
assert.ErrorIs(t, filesystem.CheckFileExists(filepath.Join(outputPath, "vmlinux")), os.ErrExist)
assert.ErrorIs(t, filesystem.CheckFileExists(filepath.Join(outputPath, "defconfig")), os.ErrExist)
if tc.wantErr == nil {
assert.ErrorIs(t, filesystem.CheckFileExists(filepath.Join(outputPath, "vmlinux")), os.ErrExist)
assert.ErrorIs(t, filesystem.CheckFileExists(filepath.Join(outputPath, "defconfig")), os.ErrExist)
}
})
}
assert.NoError(t, os.Chdir(pwd)) // just to make sure
Expand Down
4 changes: 2 additions & 2 deletions cmd/firmware-action/recipes/recipes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func TestBuild(t *testing.T) {
"edk2-build-b": {Depends: []string{}},
},
FirmwareStitching: map[string]FirmwareStitchingOpts{
"stitch": {Depends: []string{"edk2-build-a"}},
"stitch": {Depends: []string{"edk2-build-a"}},
},
},
},
Expand All @@ -239,7 +239,7 @@ func TestBuild(t *testing.T) {
"edk2-build": {Depends: []string{}},
},
FirmwareStitching: map[string]FirmwareStitchingOpts{
"stitch-a": {Depends: []string{"edk2-build"}},
"stitch-a": {Depends: []string{"edk2-build"}},
"stitch-b": {Depends: []string{"edk2-build"}},
},
},
Expand Down

0 comments on commit b086942

Please sign in to comment.