Skip to content

Commit

Permalink
fix: update universe domain URI
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer committed Aug 15, 2024
1 parent 1277062 commit 2447d22
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Credentials/GCECredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class GCECredentials extends CredentialsLoader implements
/**
* The metadata path of the project ID.
*/
const UNIVERSE_DOMAIN_URI_PATH = 'v1/universe/universe_domain';
const UNIVERSE_DOMAIN_URI_PATH = 'v1/universe/universe-domain';

/**
* The header whose presence indicates GCE presence.
Expand Down Expand Up @@ -431,7 +431,7 @@ private static function detectResidencyWindows(string $registryProductKey): bool
// which might mean that it is a windows instance that is not on GCE
return false;
}

return 0 === strpos($productName, self::PRODUCT_NAME);
}

Expand Down
6 changes: 3 additions & 3 deletions tests/Credentials/GCECredentialsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function testOnWindowsGceWithResidencyWithNoCom()

$method = (new ReflectionClass(GCECredentials::class))
->getMethod('detectResidencyWindows');

$method->setAccessible(true);

$this->assertFalse($method->invoke(null, 'thisShouldBeFalse'));
Expand Down Expand Up @@ -660,7 +660,7 @@ public function testGetUniverseDomain()
$httpHandler = function ($request) use (&$timesCalled, $expected) {
$timesCalled++;
$this->assertEquals(
'/computeMetadata/v1/universe/universe_domain',
'/computeMetadata/v1/universe/universe-domain',
$request->getUri()->getPath()
);
$this->assertEquals(1, $timesCalled, 'should only be called once');
Expand All @@ -682,7 +682,7 @@ public function testGetUniverseDomainEmptyStringReturnsDefault()
// Pretend we are on GCE and mock the MDS returning an empty string for the universe domain.
$httpHandler = function ($request) {
$this->assertEquals(
'/computeMetadata/v1/universe/universe_domain',
'/computeMetadata/v1/universe/universe-domain',
$request->getUri()->getPath()
);
return new Psr7\Response(200, [], Utils::streamFor(''));
Expand Down

0 comments on commit 2447d22

Please sign in to comment.