{wip} - unit tests
`git submodule status` will display current state, which will be overwritten by checkout submodule. Solution is to `submodule deinit` before looking at submodule status.
This commit is contained in:
parent
a230c2aa52
commit
0d9451e92c
@ -1,6 +1,6 @@
|
|||||||
module src.opensuse.org/workflow-pr
|
module src.opensuse.org/workflow-pr
|
||||||
|
|
||||||
go 1.22.3
|
go 1.23.2
|
||||||
|
|
||||||
replace src.opensuse.org/autogits/common => ../bots-common
|
replace src.opensuse.org/autogits/common => ../bots-common
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@ func setupGitForTests(t *testing.T, git *common.GitHandler) {
|
|||||||
{"prj", "submodule", "add", filepath.Join(git.GitPath, "foo"), "testRepo"},
|
{"prj", "submodule", "add", filepath.Join(git.GitPath, "foo"), "testRepo"},
|
||||||
{"prj", "add", ".gitmodules", "testRepo"},
|
{"prj", "add", ".gitmodules", "testRepo"},
|
||||||
{"prj", "commit", "-m", "First instance"},
|
{"prj", "commit", "-m", "First instance"},
|
||||||
|
{"prj", "submodule", "deinit", "testRepo"},
|
||||||
{"", "clone", "prj", common.DefaultGitPrj},
|
{"", "clone", "prj", common.DefaultGitPrj},
|
||||||
{LocalCMD, "foo", "/usr/bin/touch", "file2"},
|
{LocalCMD, "foo", "/usr/bin/touch", "file2"},
|
||||||
{"foo", "add", "file2"},
|
{"foo", "add", "file2"},
|
||||||
@ -139,6 +140,7 @@ func TestUpdatePrBranch(t *testing.T) {
|
|||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
git.GitExecOrPanic("prj", "reset", "--hard", "testing")
|
||||||
rev := strings.TrimSpace(git.GitExecWithOutputOrPanic(filepath.Join(common.DefaultGitPrj, "testRepo"), "rev-list", "-1", "HEAD"))
|
rev := strings.TrimSpace(git.GitExecWithOutputOrPanic(filepath.Join(common.DefaultGitPrj, "testRepo"), "rev-list", "-1", "HEAD"))
|
||||||
if rev != req.Pull_Request.Head.Sha {
|
if rev != req.Pull_Request.Head.Sha {
|
||||||
t.Error("prj/testRepo not updated to", req.Pull_Request.Head.Sha, "but is at", rev)
|
t.Error("prj/testRepo not updated to", req.Pull_Request.Head.Sha, "but is at", rev)
|
||||||
@ -187,6 +189,7 @@ func TestCreatePrBranch(t *testing.T) {
|
|||||||
if rev != req.Pull_Request.Head.Sha {
|
if rev != req.Pull_Request.Head.Sha {
|
||||||
t.Error("prj/testRepo not updated to", req.Pull_Request.Head.Sha, "but is at", rev)
|
t.Error("prj/testRepo not updated to", req.Pull_Request.Head.Sha, "but is at", rev)
|
||||||
t.Error(buf.String())
|
t.Error(buf.String())
|
||||||
|
// os.CopyFS("/tmp/test", os.DirFS(git.GitPath))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user