Fix build tools git tests on windows 7x (#63456)

* Add error logging for git commands in build-tools integTests
* Explicitly set user and email in git related func tests
This commit is contained in:
Rene Groeschke 2020-10-08 13:42:11 +02:00
parent acbd48f834
commit 26f58c8bdb
No known key found for this signature in database
GPG Key ID: B1782D97CBC64567
2 changed files with 20 additions and 7 deletions

View File

@ -112,8 +112,19 @@ abstract class AbstractGradleFuncTest extends Specification {
}
void setupLocalGitRepo() {
"git init".execute(Collections.emptyList(), testProjectDir.root).waitFor()
"git add .".execute(Collections.emptyList(), testProjectDir.root).waitFor()
'git commit -m "Initial"'.execute(Collections.emptyList(), testProjectDir.root).waitFor()
execute("git init")
execute('git config user.email "build-tool@elastic.co"')
execute('git config user.name "Build tool"')
execute("git add .")
execute('git commit -m "Initial"')
}
void execute(String command, File workingDir = testProjectDir.root) {
def proc = command.execute(Collections.emptyList(), workingDir)
proc.waitFor()
if(proc.exitValue()) {
println "Error running command ${command}:"
println "Syserr: " + proc.errorStream.text
}
}
}

View File

@ -142,10 +142,12 @@ class InternalDistributionBwcSetupPluginFuncTest extends AbstractGradleFuncTest
FileUtils.copyDirectory(new File(fakeRemote.file), workingRemoteGit)
fakeRemote.file + "/.git"
gradleRunner(workingRemoteGit, "wrapper").build()
"git init".execute(Collections.emptyList(), workingRemoteGit).waitFor()
"git add .".execute(Collections.emptyList(), workingRemoteGit).waitFor()
'git commit -m"Initial"'.execute(Collections.emptyList(), workingRemoteGit).waitFor()
"git checkout -b origin/8.0".execute(Collections.emptyList(), workingRemoteGit).waitFor()
execute("git init", workingRemoteGit)
execute('git config user.email "build-tool@elastic.co"', workingRemoteGit)
execute('git config user.name "Build tool"', workingRemoteGit)
execute("git add .", workingRemoteGit)
execute('git commit -m"Initial"', workingRemoteGit)
execute("git checkout -b origin/8.0", workingRemoteGit)
return workingRemoteGit;
}
}