Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

test: align deployment config redaction expectations

Andras Bacsai9b0e2704d22a
diff --git a/tests/Feature/Livewire/ConfigurationCheckerTest.php b/tests/Feature/Livewire/ConfigurationCheckerTest.php
index d9e6729c86..6194b2a1e4 100644
--- a/tests/Feature/Livewire/ConfigurationCheckerTest.php
+++ b/tests/Feature/Livewire/ConfigurationCheckerTest.php
@@ -110,6 +110,9 @@ it('refreshes stale modal configuration diff before opening changes', function (
});
it('does not render environment variable secret values', function () {
+ $this->team->members()->updateExistingPivot($this->user->id, ['role' => 'member']);
+ $this->user->unsetRelation('teams');
+
$application = configurationCheckerApplication($this->environment);
EnvironmentVariable::create([
'key' => 'API_TOKEN',
@@ -133,6 +136,9 @@ it('does not render environment variable secret values', function () {
});
it('renders added environment variables as set without exposing secret values', function () {
+ $this->team->members()->updateExistingPivot($this->user->id, ['role' => 'member']);
+ $this->user->unsetRelation('teams');
+
$application = configurationCheckerApplication($this->environment);
markConfigurationCheckerApplicationDeployed($application);
diff --git a/tests/Unit/DeploymentConfiguration/ApplicationConfigurationSnapshotTest.php b/tests/Unit/DeploymentConfiguration/ApplicationConfigurationSnapshotTest.php
index 20b7c0adc5..261ef94349 100644
--- a/tests/Unit/DeploymentConfiguration/ApplicationConfigurationSnapshotTest.php
+++ b/tests/Unit/DeploymentConfiguration/ApplicationConfigurationSnapshotTest.php
@@ -74,7 +74,7 @@ it('detects redeploy-only domain changes', function () {
->and(collect($diff->changes())->pluck('label'))->toContain('Domains');
});
-it('detects environment variable value changes without exposing secret values', function () {
+it('detects environment variable value changes for unlocked variables', function () {
$application = snapshotTestApplication();
EnvironmentVariable::create([
'key' => 'API_TOKEN',
@@ -92,13 +92,13 @@ it('detects environment variable value changes without exposing secret values',
$change = collect($diff->changes())->firstWhere('label', 'API_TOKEN');
expect($change)->not->toBeNull()
- ->and($change['display_summary'])->toBe('Changed')
- ->and($change['old_display_value'])->toBe('••••••••')
- ->and($change['new_display_value'])->toBe('••••••••')
- ->and(json_encode($diff->toArray()))->not->toContain('old-secret')->not->toContain('new-secret');
+ ->and($change['display_summary'])->toBeNull()
+ ->and($change['old_display_value'])->toBe('old-secret')
+ ->and($change['new_display_value'])->toBe('new-secret')
+ ->and(json_encode($diff->toArray()))->toContain('old-secret')->toContain('new-secret');
});
-it('describes added environment variables as set without exposing secret values', function () {
+it('describes added unlocked environment variables with their value', function () {
$application = snapshotTestApplication();
markSnapshotTestApplicationDeployed($application);
@@ -118,6 +118,6 @@ it('describes added environment variables as set without exposing secret values'
expect($change)->not->toBeNull()
->and($change['display_summary'])->toBeNull()
->and($change['old_display_value'])->toBe('-')
- ->and($change['new_display_value'])->toBe('••••••••')
- ->and(json_encode($diff->toArray()))->not->toContain('new-secret');
+ ->and($change['new_display_value'])->toBe('new-secret')
+ ->and(json_encode($diff->toArray()))->toContain('new-secret');
});