Page MenuHomeDevCentral

D584.diff
No OneTemporary

D584.diff

diff --git a/Jenkinsfile b/Jenkinsfile
deleted file mode 100644
--- a/Jenkinsfile
+++ /dev/null
@@ -1,9 +0,0 @@
-node('php') {
- stage 'Checkout tests'
- git 'https://github.com/nasqueron/operations.git'
-
- stage 'Prod tests'
- dir('tests/prod-environment-behaves-correctly') {
- sh 'make test'
- }
-}
diff --git a/tests/prod-environment-behaves-correctly/DevCentralDockerTest.php b/tests/prod-environment-behaves-correctly/DevCentralDockerTest.php
deleted file mode 100644
--- a/tests/prod-environment-behaves-correctly/DevCentralDockerTest.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-require_once 'utils/DockerContainer.php';
-
-class DevCentralDockerTest extends PHPUnit_Framework_TestCase {
- private $container;
-
- const DOCKER_CONTAINER = 'devcentral';
-
- protected function setUp () {
- if (!getenv('DOCKER_ACCESS')) {
- $this->markTestSkipped("No access to Docker engine.");
- }
-
- $this->container = new DockerContainer(getenv('DOCKER_HOST'), self::DOCKER_CONTAINER);
- }
-
- public function testInitialized () {
- //TODO: test if .initialized file exists
- $this->markTestIncomplete("This test will have to be implemented after container update.");
- }
-
- public function testProcesses () {
- $processes = $this->container->exec("ps auxw");
-
- $expectedProcesses = [
- 'nginx: master process',
- 'nginx: worker process',
- 'php-fpm: master process',
- 'PhabricatorTaskmasterDaemon',
- 'PhabricatorBot',
- ];
-
- foreach ($expectedProcesses as $expectedProcess) {
- $this->assertContains($expectedProcess, $processes, "The process $expectedProcess isn't currently launched.");
- }
- }
-}
diff --git a/tests/prod-environment-behaves-correctly/DevCentralTest.php b/tests/prod-environment-behaves-correctly/DevCentralTest.php
deleted file mode 100644
--- a/tests/prod-environment-behaves-correctly/DevCentralTest.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-require_once 'traits/assertHttp.php';
-
-class DevCentralTest extends PHPUnit_Framework_TestCase {
- use assertHttp;
-
- public function testWebsiteIsUp () {
- $this->assertHttpResponseCode(200, 'https://devcentral.nasqueron.org', "DevCentral HTTPS issue.");
- $this->assertHttpResponseCode(500, 'https://phabricator-files-for-devcentral-nasqueron.spacetechnology.net', "DevCentral alternative domain should return a 500 error code for homepage. Check phabricator.base-uri isn't empty.");
- }
-
- public function testNginxRedirectsHttpToHttps () {
- $this->assertHttpResponseCode(301, 'http://devcentral.nasqueron.org', 'Nginx should redirect http to https with a 301 code.');
- }
-
- public function testAphlictIsUp () {
- $this->assertHttpResponseCode(405, 'http://dwellers.nasqueron.org:22281/', 'Aphlict server seems down, does aphlict container is launched in Docker engine?');
- }
-}
diff --git a/tests/prod-environment-behaves-correctly/EtherpadTest.php b/tests/prod-environment-behaves-correctly/EtherpadTest.php
deleted file mode 100644
--- a/tests/prod-environment-behaves-correctly/EtherpadTest.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-require_once 'traits/assertHttp.php';
-
-class EtherpadTest extends PHPUnit_Framework_TestCase {
- use assertHttp;
-
- public function testEtherpadIsLive () {
- $this->assertHttpResponseCode(200, 'http://pad.nasqueron.org', 'Etherpad looks down.');
- $this->assertHttpResponseCode(200, 'https://pad.nasqueron.org/', "Etherpad HTTPS issue.");
- $this->assertHttpResponseCode(200, 'http://pad.wolfplex.be', "Etherpad doesn't reply to pad.wolfplex.be vhost.");
- $this->assertHttpResponseCode(404, 'http://pad.nasqueron.org/notexisting', 'A 404 code were expected for a not existing Etherpad page.');
- $this->assertHttpResponseCode(200, 'http://pad.nasqueron.org/metrics', "ep_ether-o-meter plugin doesn't seem installed.");
- }
-
- public function testWolfplexApiWorks () {
- //Reported by philectro - 09:42 < philectro> hey tous les pad ont disparu :o
-
- $url = "http://www.wolfplex.be/pad/";
- $this->assertHttpResponseCode(200, $url);
-
- $stringOnlyAvailableWhenApiWorks = '<li><a href="/pad/';
- $currentContent = file_get_contents($url);
- $this->assertContains($stringOnlyAvailableWhenApiWorks, $currentContent, "On Ysul, /home/wolfplex.org/logs/api.log could help. But more probably, you reinstalled the Etherpad container without restoring the API key. Move the former APIKEY.txt file to /opt/etherpad-lite or, if lost, update Wolfplex API credentials with the new API key.");
- }
-}
diff --git a/tests/prod-environment-behaves-correctly/Makefile b/tests/prod-environment-behaves-correctly/Makefile
deleted file mode 100644
--- a/tests/prod-environment-behaves-correctly/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-###
-### Nasqueron ops tests
-### We use PHPUnit to test several parts of our infrastructure.
-###
-
-ENV_FOR_TEST_FULL= \
- DOCKER_ACCESS=1 \
- DOCKER_HOST=dwellers.nasqueron.org \
-
-test:
- phpunit .
-
-test-full:
- sh -c "${ENV_FOR_TEST_FULL} phpunit ."
diff --git a/tests/prod-environment-behaves-correctly/NotificationsTest.php b/tests/prod-environment-behaves-correctly/NotificationsTest.php
deleted file mode 100644
--- a/tests/prod-environment-behaves-correctly/NotificationsTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-require_once 'traits/assertHttp.php';
-
-class NotificationsTest extends PHPUnit_Framework_TestCase {
- use assertHttp;
-
- public function testIsLive () {
- $this->assertHttpResponseCode(200, 'http://notifications.nasqueron.org', 'Notifications center looks down.');
- $this->assertHttpResponseCode(404, 'http://notifications.nasqueron.org/notexisting', 'A 404 code were expected for a not existing page.');
- }
-
- public function testSSL () {
- $this->assertHttpResponseCode(200, 'https://notifications.nasqueron.org/', "Notifications center HTTPS issue.");
- }
-
- public function testAlive () {
- $url = 'http://notifications.nasqueron.org/status';
- $this->assertHttpResponseCode(200, $url);
- $this->assertSame('ALIVE', file_get_contents($url));
- }
-
- public function testGates () {
- $this->assertHttpResponseCode(200, 'http://notifications.nasqueron.org/gate/GitHub', 'Gate missing: check GitHub is declared');
- $this->assertHttpResponseCode(200, 'http://notifications.nasqueron.org/gate/Phabricator/Nasqueron', 'Gate missing: check DevCentral is declared in credentials.json');
- }
-}
diff --git a/tests/prod-environment-behaves-correctly/TommyTest.php b/tests/prod-environment-behaves-correctly/TommyTest.php
deleted file mode 100644
--- a/tests/prod-environment-behaves-correctly/TommyTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-require_once 'traits/assertHttp.php';
-
-class TommyTest extends PHPUnit_Framework_TestCase {
- use assertHttp;
-
- public function testIsLive () {
- $this->assertHttpResponseCode(200, 'http://builds.nasqueron.org', 'Tommy looks down.');
- $this->assertHttpResponseCode(404, 'http://builds.nasqueron.org/notexisting', 'A 404 code were expected for a not existing page.');
- }
-
- public function testSSL () {
- $this->assertHttpResponseCode(200, 'https://builds.nasqueron.org/', "Tommy HTTPS issue.");
- }
-
- public function testAlive () {
- $url = 'https://builds.nasqueron.org/status';
- $this->assertHttpResponseCode(200, $url);
- $this->assertSame('ALIVE', file_get_contents($url));
- }
-
- public function testDashboard () {
- $content = file_get_contents('https://builds.nasqueron.org');
- $this->assertContains('ci.nasqueron.org/job/', $content);
- }
-}
diff --git a/tests/prod-environment-behaves-correctly/YsulApacheTest.php b/tests/prod-environment-behaves-correctly/YsulApacheTest.php
deleted file mode 100644
--- a/tests/prod-environment-behaves-correctly/YsulApacheTest.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-require_once 'traits/assertHttp.php';
-
-class YsulApacheTest extends PHPUnit_Framework_TestCase {
- use assertHttp;
-
- /**
- * Apache server hostname to tet
- */
- const SERVER = 'ysul.nasqueron.org';
-
- /**
- * Apache port
- */
- const PORT = 3200;
-
- /**
- * Path to SuEXEC binary
- */
- const SUEXEC = '/usr/local/sbin/suexec';
-
- public function testApacheIsLive () {
- $url = "http://" . self::SERVER . ":" . self::PORT . "/";
- $this->assertHttpResponseCode(200, $url, "Apache looks down.");
- }
-
- public function testSuEXECHasBeenInstalled () {
- // Reported by amj on T823, see also T508 and T517.
-
- if (gethostname() !== self::SERVER) {
- $this->markTestSkipped(
- "This test can only run on " . self::SERVER
- );
- };
-
- $this->assertTrue(
- file_exists(self::SUEXEC)
- );
- }
-}
diff --git a/tests/prod-environment-behaves-correctly/traits/assertHttp.php b/tests/prod-environment-behaves-correctly/traits/assertHttp.php
deleted file mode 100644
--- a/tests/prod-environment-behaves-correctly/traits/assertHttp.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-trait assertHttp {
- /**
- * Asserts the HTTP response code of an URL matches the expected code
- *
- * @param int $expectedCode the expected HTTP response code
- * @param string $url the URL to check
- * @param string $comment the comment to output if the test fails [facultative]
- */
- private function assertHttpResponseCode ($expectedCode, $url, $comment = '') {
- $actualCode = $this->getHttpResponseCode($url);
- return $this->assertEquals($expectedCode, $actualCode, $comment);
- }
-
- /**
- * Gets the HTTP response code of the specified URL
- *
- * @param string $url
- * @return int the HTTP response code
- */
- private function getHttpResponseCode ($url) {
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_USERAGENT, "Nasqueron-Ops-Tests");
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_exec($ch);
- $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
- curl_close($ch);
- return $code;
- }
-}
diff --git a/tests/prod-environment-behaves-correctly/utils/DockerContainer.php b/tests/prod-environment-behaves-correctly/utils/DockerContainer.php
deleted file mode 100644
--- a/tests/prod-environment-behaves-correctly/utils/DockerContainer.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-
-class DockerContainer {
- private $host;
- private $container;
-
- /**
- * Initializes a new instance of the DockerContainer class
- *
- * @param string $host hostname
- * @param string $container container name
- */
- public function __construct ($host, $container) {
- if (!self::isValidHostname($host)) {
- throw new ArgumentException("Invalid hostname.");
- }
- if (!self::isValidContainerName($container)) {
- throw new ArgumentException("Invalid container name.");
- }
-
- $this->host = $host;
- $this->container = $container;
- }
-
- /**
- * Determines if a hostname is valid
- *
- * @return bool true if the specified name is valid; otherwise, false
- */
- public static function isValidHostname ($host) {
- return (bool)preg_match('/^[A-Za-z0-9\-\.]+$/', $host);
- }
-
- /**
- * Determines if a container name is valid
- *
- * @return bool true if the specified name is valid; otherwise, false
- */
- public static function isValidContainerName ($name) {
- //Source: https://github.com/ajhager/docker/commit/f63cdf0260cf6287d28a589a79d3f947def6a569
- return (bool)preg_match('@^/?[a-zA-Z0-9_-]+$@', $name);
- }
-
- /**
- * Executes the specified command in the container
- *
- * @param string $command the command to run
- * @return string the command output
- */
- public function exec ($command) {
- return `ssh $this->host docker exec $this->container $command`;
- }
-}

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 19:38 (19 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2258784
Default Alt Text
D584.diff (11 KB)

Event Timeline