def test_upload_artifact_with_customArtifactPath_as_Interpolate(self): customArtifactPath = Interpolate("Art-%(src:fmod:revision)s") sourcestamp = StubSourceStamp() self.setupStep(artifact.UploadArtifact( artifact="myartifact.py", artifactDirectory="mydir", artifactServer='*****@*****.**', artifactServerDir='/home/srv/web/dir', artifactServerURL="http://srv.com/dir", customArtifactPath=customArtifactPath), sources={'fmod': sourcestamp}) self.expectCommands( ExpectShell( workdir='wkdir', usePTY='slave-config', command= 'for i in 1 2 3 4 5; do rsync -var --progress --partial ' + self.local + ' ' + self.remote_custom_interpolate + '; if [ $? -eq 0 ]; then exit 0; else sleep 5; fi; done; exit -1' ) + ExpectShell.log('stdio', stdout='') + 0) self.expectOutcome(result=SUCCESS, status_text=['Artifact(s) uploaded.']) self.expectProperty('artifactServerPath', 'http://srv.com/dir/Art-abcde', 'UploadArtifact') return self.runStep()
def test_upload_artifact_Win(self): self.setupStep(artifact.UploadArtifact( artifact="myartifact.py", artifactDirectory="mydir", artifactServer='*****@*****.**', artifactServerDir='/home/srv/web/dir', artifactServerURL="http://srv.com/dir"), winslave=True) self.expectCommands( ExpectShell( workdir='wkdir', usePTY='slave-config', command='powershell.exe -C for ($i=1; $i -le 5; $i++) ' + '{ rsync -var --progress --partial ' + self.local + ' ' + self.remote + '; if ($?) { exit 0 } else { sleep 5} } exit -1') + ExpectShell.log('stdio', stdout='') + 0) self.expectOutcome(result=SUCCESS, status_text=['Artifact(s) uploaded.']) return self.runStep()
def test_upload_artifact_Win_DOS(self): self.setupStep(artifact.UploadArtifact( artifact="myartifact.py", artifactDirectory="mydir", artifactServer='*****@*****.**', artifactServerDir='/home/srv/web/dir', artifactServerURL="http://srv.com/dir", usePowerShell=False), winslave=True) self.expectCommands( ExpectShell( workdir='wkdir', usePTY='slave-config', command= 'for /L %%i in (1,1,5) do (sleep 5 & rsync -var --progress --partial ' + self.local + ' ' + self.remote + ' && exit 0)') + ExpectShell.log('stdio', stdout='') + 0) self.expectOutcome(result=SUCCESS, status_text=['Artifact(s) uploaded.']) return self.runStep()
def test_upload_artifact_with_customArtifactPath(self): self.setupStep( artifact.UploadArtifact(artifact="myartifact.py", artifactDirectory="mydir", artifactServer='*****@*****.**', artifactServerDir='/home/srv/web/dir', artifactServerURL="http://srv.com/dir", customArtifactPath="foobar")) self.expectCommands( ExpectShell( workdir='wkdir', usePTY='slave-config', command= 'for i in 1 2 3 4 5; do rsync -var --progress --partial ' + self.local + ' ' + self.remote_custom + '; if [ $? -eq 0 ]; then exit 0; else sleep 5; fi; done; exit -1' ) + ExpectShell.log('stdio', stdout='') + 0) self.expectOutcome(result=SUCCESS, status_text=['Artifact(s) uploaded.']) self.expectProperty('artifactServerPath', 'http://srv.com/dir/foobar', 'UploadArtifact') return self.runStep()