Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3775234
D1967.diff
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
D1967.diff
View Options
diff --git a/PaaSDockerTest.php b/PaaSDockerTest.php
new file mode 100644
--- /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
--- a/composer.json
+++ b/composer.json
@@ -3,7 +3,8 @@
"description": "Tests to validate production environment",
"type": "project",
"require": {
- "phpunit/phpunit": "^7.3"
+ "phpunit/phpunit": "^7.3",
+ "ext-yaml": "*"
},
"license": "BSD-2-Clause",
"authors": [
diff --git a/utils/OperationsConfiguration.php b/utils/OperationsConfiguration.php
new file mode 100644
--- /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/plain
Expires
Mon, Nov 25, 17:38 (21 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2262864
Default Alt Text
D1967.diff (2 KB)
Attached To
Mode
D1967: Hunt missing 502 pages for Docker services
Attached
Detach File
Event Timeline
Log In to Comment