Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F11726407
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/PaaSDockerTest.php b/PaaSDockerTest.php
new file mode 100644
index 0000000..50cd37d
--- /dev/null
+++ b/PaaSDockerTest.php
@@ -0,0 +1,32 @@
+<?php
+
+require_once 'traits/assertHttp.php';
+require_once 'utils/OperationsConfiguration.php';
+
+use Nasqueron\Infrastructure\OperationsConfiguration;
+
+class PaaSDockerTest extends PHPUnit\Framework\TestCase {
+
+ use assertHttp;
+
+ /**
+ * @dataProvider provideDockerDomains
+ *
+ * @param string $domain A domain declared in the PaaS Docker configuration
+ * as an HTTP upstream block for a Docker container
+ */
+ public function test502Pages (string $domain) : void {
+ $url = "https://$domain/502.html";
+
+ $this->assertHttpResponseCode(200, $url, "A 502 page is missing for $domain");
+ }
+
+ public function provideDockerDomains () : iterable {
+ $domains = OperationsConfiguration::getDockerDomains();
+
+ foreach ($domains as $domain) {
+ yield [$domain];
+ }
+ }
+
+}
diff --git a/composer.json b/composer.json
index 8299098..7186e37 100644
--- a/composer.json
+++ b/composer.json
@@ -1,15 +1,16 @@
{
"name": "nasqueron/tests-prod-environment-behaves-correctly",
"description": "Tests to validate production environment",
"type": "project",
"require": {
- "phpunit/phpunit": "^7.3"
+ "phpunit/phpunit": "^7.3",
+ "ext-yaml": "*"
},
"license": "BSD-2-Clause",
"authors": [
{
"name": "Sébastien Santoro",
"email": "dereckson@espace-win.org"
}
]
}
diff --git a/utils/OperationsConfiguration.php b/utils/OperationsConfiguration.php
new file mode 100644
index 0000000..a3a6c43
--- /dev/null
+++ b/utils/OperationsConfiguration.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace Nasqueron\Infrastructure;
+
+class OperationsConfiguration {
+
+ const PILLAR_BASE = "https://raw.githubusercontent.com/nasqueron/operations/master/pillar/";
+
+ public static function getDockerDomains () : array {
+ $domains = [];
+
+ $pillar = self::readPillarFile("paas/docker.sls");
+ foreach ($pillar['docker_containers'] as $instances) {
+ foreach ($instances as $containers) {
+ foreach ($containers as $instance) {
+ if (isset($instance['host'])) {
+ $domains[] = $instance['host'];
+ }
+ }
+ }
+ }
+
+ return $domains;
+ }
+
+ public static function readPillarFile ($path) : iterable {
+ $url = self::PILLAR_BASE . $path;
+ $yaml = file_get_contents($url);
+
+ return yaml_parse($yaml);
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Fri, Sep 19, 03:16 (23 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2992138
Default Alt Text
(2 KB)
Attached To
Mode
rTESTSPRODENV Test suite for operations: prod-environment-behaves-correctly
Attached
Detach File
Event Timeline
Log In to Comment