Skip to content

Commit

Permalink
Make sure we can install a bitbucket project with app pass and privat…
Browse files Browse the repository at this point in the history
…e deps (#726)

* Make sure we can install a bitbucket project with app pass and private deps

* Update test.yml

* Try to fix tests
  • Loading branch information
eiriksm authored Nov 20, 2024
1 parent 4774966 commit 4ef44df
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,5 @@ jobs:
GITHUB_PRIVATE_INDIRECT_WITH_DIRECT: ${{ secrets.GH_PRIVATE_INDIRECT_WITH_DIRECT }}
GITLAB_SUPER_SECRET_URL_FOR_TOKEN: ${{ secrets.GITLAB_SUPER_SECRET_URL_FOR_TOKEN }}
VALID_CI_LICENCE: ${{ secrets.VALID_CI_LICENCE }}
BITBUCKET_APP_PASSWORD: ${{ secrets.BITBUCKET_APP_PASSWORD }}
BITBUCKET_WITH_PRIVATE_DEP: ${{ secrets.BITBUCKET_WITH_PRIVATE_DEP }}
13 changes: 13 additions & 0 deletions tests/Integration/BitbucketWithPrivateDependencyTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Violinist\UpdateCheckRunner\Tests\Integration;

class BitbucketWithPrivateDependencyTest extends IntegrationBase
{
public function testRunBitbucketWithPrivateDepdendencies() : void
{
$repo = $_SERVER['BITBUCKET_WITH_PRIVATE_DEP'];
$json = $this->getProcessAndRunWithoutError($_SERVER['BITBUCKET_APP_PASSWORD'], $repo);
self::findMessage('composer install completed successfully', $json);
}
}
10 changes: 5 additions & 5 deletions tests/Integration/IntegrationBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ protected function assertHashLogged($json)
$this->assertTrue(false, 'The message ' . $expected_message . ' was not found in the output.');
}

protected function findMessage($message, $json)
public static function findMessage(string $message, array $json) : \stdClass
{
foreach ($json as $item) {
if ($item->message === $message) {
return $item;
}
}
$this->assertTrue(false, 'The message ' . $message . ' was not found in the output.');
throw new \Exception('The message ' . $message . ' was not found in the output.');
}

protected function assertProjectStarting($url, $json)
Expand Down Expand Up @@ -127,7 +127,7 @@ protected function getProcessAndRun($token, $url, $other_env = [])
return $process;
}

protected function getProcessAndRunGetJson($token, $url, $other_env = [])
protected function getProcessAndRunGetJson($token, $url, $other_env = []) : array
{
$process = $this->getProcessAndRun($token, $url, $other_env);
$json = @json_decode($process->getOutput());
Expand All @@ -139,7 +139,7 @@ protected function getProcessAndRunGetJson($token, $url, $other_env = [])
return $json;
}

protected function getProcessAndRunWithoutError($token, $url, $other_env = [])
protected function getProcessAndRunWithoutError($token, $url, $other_env = []) : array
{
$process = $this->getProcessAndRun($token, $url, $other_env);
if ($process->getExitCode()) {
Expand All @@ -154,7 +154,7 @@ protected function getProcessAndRunWithoutError($token, $url, $other_env = [])
return $json;
}

protected function getGitlabToken($url)
protected function getGitlabToken(string $url) : string
{
if (strpos($url, '172.17.0.1')) {
// This does not need refreshing as we just created it.
Expand Down

0 comments on commit 4ef44df

Please sign in to comment.