diff --git a/tests/Orchestration/Base.php b/tests/Orchestration/Base.php index 77ccfa5..429f3a2 100644 --- a/tests/Orchestration/Base.php +++ b/tests/Orchestration/Base.php @@ -37,18 +37,18 @@ public function testPullImage(): void */ $response = static::getOrchestration()->pull('appwrite/runtime-for-php:8.0'); - $this->assertEquals(true, $response); + $this->assertSame(true, $response); // Used later for CPU usage test $response = static::getOrchestration()->pull('containerstack/alpine-stress:latest'); - $this->assertEquals(true, $response); + $this->assertSame(true, $response); /** * Test for Failure */ $response = static::getOrchestration()->pull('appwrite/tXDytMhecKCuz5B4PlITXL1yKhZXDP'); // Pull non-existent Container - $this->assertEquals(false, $response); + $this->assertSame(false, $response); } /** @@ -105,7 +105,7 @@ public function testCreateContainer(): void $this->assertGreaterThanOrEqual(2, $occurances); // 2 logs mean it restarted at least once $response = static::getOrchestration()->remove('TestContainerWithRestart', true); - $this->assertEquals(true, $response); + $this->assertSame(true, $response); // "No" Restart policy test $response = static::getOrchestration()->run( @@ -134,10 +134,10 @@ public function testCreateContainer(): void \exec('docker logs '.$response, $output); $output = \implode("\n", $output); $occurances = \substr_count($output, 'Custom start'); - $this->assertEquals(1, $occurances); + $this->assertSame(1, $occurances); $response = static::getOrchestration()->remove('TestContainerWithoutRestart', true); - $this->assertEquals(true, $response); + $this->assertSame(true, $response); /** * Test for Failure @@ -189,7 +189,7 @@ public function testCreateNetwork(): void { $response = static::getOrchestration()->createNetwork('TestNetwork'); - $this->assertEquals(true, $response); + $this->assertSame(true, $response); } /** @@ -207,7 +207,7 @@ public function testListNetworks(): void } } - $this->assertEquals(true, $foundNetwork); + $this->assertSame(true, $foundNetwork); } /** @@ -244,7 +244,7 @@ public function testNetworkConnect(): void $response = static::getOrchestration()->networkConnect('TestContainer', 'TestNetwork'); - $this->assertEquals(true, $response); + $this->assertSame(true, $response); } /** @@ -254,7 +254,7 @@ public function testNetworkDisconnect(): void { $response = static::getOrchestration()->networkDisconnect('TestContainer', 'TestNetwork', true); - $this->assertEquals(true, $response); + $this->assertSame(true, $response); } /** @@ -264,7 +264,7 @@ public function testRemoveNetwork(): void { $response = static::getOrchestration()->removeNetwork('TestNetwork'); - $this->assertEquals(true, $response); + $this->assertSame(true, $response); } /** @@ -333,7 +333,7 @@ public function testExecContainer(): void ], ); - $this->assertEquals('Hello World! testEnviromentVariable', $output); + $this->assertSame('Hello World! testEnviromentVariable', $output); /** * Test for Success @@ -354,7 +354,7 @@ public function testExecContainer(): void $length += 5; // "start" $length += 3; // "end" - $this->assertEquals($length, \strlen($output)); + $this->assertSame($length, \strlen($output)); $this->assertStringStartsWith('START', $output); $this->assertStringEndsWith('END', $output); } @@ -375,7 +375,7 @@ public function testCheckVolume(): void $output ); - $this->assertEquals('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras dapibus turpis mauris, ac consectetur odio varius ullamcorper.', $output); + $this->assertSame('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras dapibus turpis mauris, ac consectetur odio varius ullamcorper.', $output); } /** @@ -445,7 +445,7 @@ public function testTimeoutContainer(): void 10 ); - $this->assertEquals(true, $response); + $this->assertSame(true, $response); /** * Test for Success @@ -464,8 +464,8 @@ public function testTimeoutContainer(): void 10 ); - $this->assertEquals('Hello World!', $output); - $this->assertEquals(true, $response); + $this->assertSame('Hello World!', $output); + $this->assertSame(true, $response); } /** @@ -483,7 +483,7 @@ public function testListContainers(): void } } - $this->assertEquals(true, $foundContainer); + $this->assertSame(true, $foundContainer); } /** @@ -493,7 +493,7 @@ public function testListFilters(): void { $response = $this->getOrchestration()->list(['id' => self::$containerID]); - $this->assertEquals(self::$containerID, $response[0]->getId()); + $this->assertSame(self::$containerID, $response[0]->getId()); } /** @@ -506,10 +506,10 @@ public function testRemoveContainer(): void */ $response = static::getOrchestration()->remove('TestContainer', true); - $this->assertEquals(true, $response); + $this->assertSame(true, $response); $response = static::getOrchestration()->remove('TestContainerTimeout', true); - $this->assertEquals(true, $response); + $this->assertSame(true, $response); /** * Test for Failure @@ -526,7 +526,7 @@ public function testParseCLICommand(): void */ $test = static::getOrchestration()->parseCommandString("sh -c 'mv /tmp/code.tar.gz /usr/local/src/code.tar.gz && tar -zxf /usr/local/src/code.tar.gz --strip 1 && rm /usr/local/src/code.tar.gz && tail -f /dev/null'"); - $this->assertEquals([ + $this->assertSame([ 'sh', '-c', "'mv /tmp/code.tar.gz /usr/local/src/code.tar.gz && tar -zxf /usr/local/src/code.tar.gz --strip 1 && rm /usr/local/src/code.tar.gz && tail -f /dev/null'", @@ -534,7 +534,7 @@ public function testParseCLICommand(): void $test = static::getOrchestration()->parseCommandString('sudo apt-get update'); - $this->assertEquals([ + $this->assertSame([ 'sudo', 'apt-get', 'update', @@ -542,7 +542,7 @@ public function testParseCLICommand(): void $test = static::getOrchestration()->parseCommandString('test'); - $this->assertEquals([ + $this->assertSame([ 'test', ], $test); @@ -588,7 +588,7 @@ public function testRunRemove(): void // Check if container exists $statusResponse = static::getOrchestration()->list(['id' => $response]); - $this->assertEquals(0, count($statusResponse)); + $this->assertSame(0, count($statusResponse)); } /** @@ -650,9 +650,9 @@ public function testUsageStats(): void $this->assertCount(2 + 1, $stats); // +1 due to container running tests $this->assertNotEmpty($stats[0]->getContainerId()); - $this->assertEquals(64, \strlen($stats[0]->getContainerId())); + $this->assertSame(64, \strlen($stats[0]->getContainerId())); - $this->assertEquals('UsageStats2', $stats[0]->getContainerName()); + $this->assertSame('UsageStats2', $stats[0]->getContainerName()); $this->assertGreaterThanOrEqual(0, $stats[0]->getCpuUsage()); $this->assertLessThanOrEqual(2, $stats[0]->getCpuUsage()); // Sometimes it gives like 102% usage @@ -681,33 +681,33 @@ public function testUsageStats(): void $statsName1 = static::getOrchestration()->getStats('UsageStats1'); $statsName2 = static::getOrchestration()->getStats('UsageStats2'); - $this->assertEquals($statsName1[0]->getContainerId(), $stats1[0]->getContainerId()); - $this->assertEquals($statsName1[0]->getContainerName(), $stats1[0]->getContainerName()); - $this->assertEquals($statsName2[0]->getContainerName(), $stats2[0]->getContainerName()); - $this->assertEquals($statsName2[0]->getContainerName(), $stats2[0]->getContainerName()); + $this->assertSame($statsName1[0]->getContainerId(), $stats1[0]->getContainerId()); + $this->assertSame($statsName1[0]->getContainerName(), $stats1[0]->getContainerName()); + $this->assertSame($statsName2[0]->getContainerName(), $stats2[0]->getContainerName()); + $this->assertSame($statsName2[0]->getContainerName(), $stats2[0]->getContainerName()); - $this->assertEquals($stats[1]->getContainerId(), $stats1[0]->getContainerId()); - $this->assertEquals($stats[1]->getContainerName(), $stats1[0]->getContainerName()); - $this->assertEquals($stats[0]->getContainerId(), $stats2[0]->getContainerId()); - $this->assertEquals($stats[0]->getContainerName(), $stats2[0]->getContainerName()); + $this->assertSame($stats[1]->getContainerId(), $stats1[0]->getContainerId()); + $this->assertSame($stats[1]->getContainerName(), $stats1[0]->getContainerName()); + $this->assertSame($stats[0]->getContainerId(), $stats2[0]->getContainerId()); + $this->assertSame($stats[0]->getContainerName(), $stats2[0]->getContainerName()); $this->assertGreaterThanOrEqual(0, $stats[0]->getCpuUsage()); $this->assertGreaterThanOrEqual(0, $stats[1]->getCpuUsage()); $statsFiltered = static::getOrchestration()->getStats(filters: ['label' => 'utopia-container-type=stats']); $this->assertCount(1, $statsFiltered); - $this->assertEquals($containerId1, $statsFiltered[0]->getContainerId()); + $this->assertSame($containerId1, $statsFiltered[0]->getContainerId()); $statsFiltered = static::getOrchestration()->getStats(filters: ['label' => 'utopia-container-type=non-existing-type']); $this->assertCount(0, $statsFiltered); $response = static::getOrchestration()->remove('UsageStats1', true); - $this->assertEquals(true, $response); + $this->assertSame(true, $response); $response = static::getOrchestration()->remove('UsageStats2', true); - $this->assertEquals(true, $response); + $this->assertSame(true, $response); /** * Test for Failure