Example #1
0
 def test_download_artifact_reusing_build(self):
     fake_br2 = fakedb.BuildRequest(id=2,
                                    buildsetid=2,
                                    buildername="B",
                                    complete=1,
                                    results=0,
                                    triggeredbybrid=0,
                                    startbrid=0)
     fake_trigger = fakedb.BuildRequest(id=3,
                                        buildsetid=3,
                                        buildername="B",
                                        complete=1,
                                        results=0,
                                        triggeredbybrid=1,
                                        startbrid=1,
                                        artifactbrid=2)
     self.setupStep(
         artifact.DownloadArtifact(artifactBuilderName="B",
                                   artifact="myartifact.py",
                                   artifactDirectory="mydir",
                                   artifactServer='*****@*****.**',
                                   artifactServerDir='/home/srv/web/dir'),
         [fake_br2, fake_trigger])
     self.expectCommands(
         ExpectShell(
             workdir='wkdir',
             usePTY='slave-config',
             command=
             'for i in 1 2 3 4 5; do rsync -var --progress --partial ' +
             self.remote_2 + ' ' + self.local +
             '; if [ $? -eq 0 ]; then exit 0; else sleep 5; fi; done; exit -1'
         ) + ExpectShell.log('stdio', stdout='') + 0)
     self.expectOutcome(result=SUCCESS, status_text=["Downloaded 'B'."])
     return self.runStep()
Example #2
0
    def test_download_artifact_Win_DOS(self):
        fake_trigger = fakedb.BuildRequest(id=2,
                                           buildsetid=2,
                                           buildername="B",
                                           complete=1,
                                           results=0,
                                           triggeredbybrid=1,
                                           startbrid=1)
        self.setupStep(artifact.DownloadArtifact(
            artifactBuilderName="B",
            artifact="myartifact.py",
            artifactDirectory="mydir",
            artifactServer='*****@*****.**',
            artifactServerDir='/home/srv/web/dir',
            usePowerShell=False), [fake_trigger],
                       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.remote_2 + ' ' + self.local + ' && exit 0)') +
            ExpectShell.log('stdio', stdout='') + 0)
        self.expectOutcome(result=SUCCESS, status_text=["Downloaded 'B'."])
        return self.runStep()
Example #3
0
    def test_download_artifact_Win_with_port(self):
        fake_trigger = fakedb.BuildRequest(id=2,
                                           buildsetid=2,
                                           buildername="B",
                                           complete=1,
                                           results=0,
                                           triggeredbybrid=1,
                                           startbrid=1)
        self.setupStep(artifact.DownloadArtifact(
            artifactBuilderName="B",
            artifact="myartifact.py",
            artifactDirectory="mydir",
            artifactServer='*****@*****.**',
            artifactServerPort=222,
            artifactServerDir='/home/srv/web/dir'), [fake_trigger],
                       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.remote_2 + ' ' +
                self.local +
                ' --rsh=\'ssh -p 222\'; if ($?) { exit 0 } else { sleep 5} } exit -1'
            ) + ExpectShell.log('stdio', stdout='') + 0)
        self.expectOutcome(result=SUCCESS, status_text=["Downloaded 'B'."])
        return self.runStep()
Example #4
0
    def test_download_artifact_with_customArtifactPath_as_Interpolate(self):
        customArtifactPath = Interpolate("Art-%(src:fmod:revision)s")
        sourcestamp = StubSourceStamp()
        fake_trigger = fakedb.BuildRequest(id=2,
                                           buildsetid=2,
                                           buildername="B",
                                           complete=1,
                                           results=0,
                                           triggeredbybrid=1,
                                           startbrid=1)
        self.setupStep(artifact.DownloadArtifact(
            artifactBuilderName="B",
            artifact="myartifact.py",
            artifactDirectory="mydir",
            artifactServer='*****@*****.**',
            artifactServerDir='/home/srv/web/dir',
            customArtifactPath=customArtifactPath), [fake_trigger],
                       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.remote_custom_interpolate + ' ' + self.local +
                '; if [ $? -eq 0 ]; then exit 0; else sleep 5; fi; done; exit -1'
            ) + ExpectShell.log('stdio', stdout='') + 0)
        self.expectOutcome(result=SUCCESS, status_text=["Downloaded 'B'."])
        return self.runStep()