Point the stage checkout at Gitea and keep its host ports off prod Reverb.
Cloning from the prod directory made SHA fetches fail, and APP_HOST_PORT 18180 collided with production Reverb.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class SetupStageScriptTest extends TestCase
|
||||
{
|
||||
public function test_clones_from_gitea_and_retargets_origin(): void
|
||||
{
|
||||
$script = file_get_contents(dirname(__DIR__, 2).'/scripts/setup-stage.sh');
|
||||
|
||||
$this->assertIsString($script);
|
||||
$this->assertStringContainsString('git clone "${GITEA_REPO_URL}" "${STAGE_PATH}"', $script);
|
||||
$this->assertStringContainsString('git remote set-url origin "${GITEA_REPO_URL}"', $script);
|
||||
$this->assertStringNotContainsString('git clone "${PROD_PATH}"', $script);
|
||||
$this->assertStringContainsString('APP_HOST_PORT" "18280"', $script);
|
||||
$this->assertStringNotContainsString('APP_HOST_PORT" "18180"', $script);
|
||||
}
|
||||
|
||||
public function test_deploy_fetches_advertised_refs_before_sha(): void
|
||||
{
|
||||
$script = file_get_contents(dirname(__DIR__, 2).'/scripts/deploy-production.sh');
|
||||
|
||||
$this->assertIsString($script);
|
||||
$this->assertStringContainsString("git fetch --force origin '+refs/heads/*:refs/remotes/origin/*'", $script);
|
||||
$this->assertStringContainsString('git checkout --force --detach "${DEPLOY_SHA}"', $script);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user