Diferencia entre revisiones de «Usuario:ManuelRomero/proyecto/proyectoIternova/borrador»

De WikiEducator
Saltar a: navegación, buscar
 
(Una revisión intermedia por el mismo usuario no mostrado)
Línea 1: Línea 1:
<source lang=bash>
+
<source lang=php>
 +
/**
 +
    * @covers Monitorizacion_Controller_Servoces::get_value_of_performance_data
 +
    * @group production
 +
    * @runInSeparateProcess
 +
    */
 +
    public function testGet_value_of_performance_data() {
  
docker start itenova
+
        $array = array(
docker start nagios1
+
            array( 'expected' => 0.013585, 'input' => "time=0.013585s;;;0.000000;10.000000", 'type' => 'float' ),
docker start nagios2
+
            array( 'expected' => null, 'input' => "time=;;;0.000000;10.000000", 'type' => 'null' ),
 +
        );
 +
        foreach ( $array as $index => $data ) {
 +
//            echo PHP_EOL;
 +
            $value_returned = Monitorizacion_Controller_Services::get_value_of_performance_data( $data[ 'input' ] );
 +
//            echo ">>>" . $data['input'] . PHP_EOL;
 +
//            echo ">>>" . $data['expected'] . PHP_EOL;
 +
//            echo ">>>" . $value_returned . PHP_EOL;
 +
            $this->assertEquals( $data[ 'expected' ], $value_returned, "ERROR: " . $data[ 'expected' ] . " != " . $value_returned, 0.001 );
 +
            $this->assertInternalType( $data[ 'type' ], $value_returned );
 +
        }
  
 +
    }
  
docker exec iternova  bash ./servicios
+
    /**
docker exec nagios1 bash ./servicios
+
    * @covers Monitorizacion_Controller::service_host_to_string
docker exec nagios2 bash ./servicios
+
    * @group production
 +
    * @runInSeparateProcess
 +
    */
 +
    public function testService_host_to_string() {
 +
// Comparacion de fechas
 +
        $array = array(
 +
            Monitorizacion_Constants::SERVICIO_SSH => 'SSH',
 +
            Monitorizacion_Constants::SERVICIO_HTTP => 'HTTP',
 +
            Monitorizacion_Constants::SERVICIO_MYSQL => 'MYSQL',
 +
            Monitorizacion_Constants::SERVICIO_DISCOS => 'DISK',
 +
            Monitorizacion_Constants::SERVICIO_CPU => 'CPU',
 +
            Monitorizacion_Constants::SERVICIO_PING => 'PING',
 +
            -1 => null
 +
        );
 +
        foreach ( $array as $servicio => $value_expected ) {
 +
            $this->assertEquals( $value_expected, Monitorizacion_Controller::service_host_to_string( $servicio ), "ERROR: $value_expected != " . Monitorizacion_Controller::service_host_to_string( $servicio ) );
 +
        }
  
 
+
    }
gnome-terminal -e "docker exec -ti iternova bash"
+
 
+
 
+
 
+
docker start host1
+
docker start host2
+
docker start host3
+
docker start host4
+
docker start host5
+
docker start host6
+
 
+
 
+
 
+
docker exec  host1 ./services
+
docker exec  host2 ./services
+
docker exec  host3 ./services
+
docker exec  host4 ./services
+
docker exec  host5 ./services
+
docker exec  host6 ./services
+
 
+
 
+
 
+
 
+
 
+
if [ -z "$1" ]
+
then
+
gnome-terminal -e "docker exec -ti nagios1 bash"
+
gnome-terminal -e "docker exec -ti nagios1 bash"
+
gnome-terminal -e "docker exec -ti host1 bash"
+
gnome-terminal -e "docker exec -ti host2 bash"
+
Escriba ":quit<intro>" para salir de Vim       
+
 
</source>
 
</source>

Última revisión de 11:21 8 sep 2017

 /**
     * @covers Monitorizacion_Controller_Servoces::get_value_of_performance_data
     * @group production
     * @runInSeparateProcess
     */
    public function testGet_value_of_performance_data() {
 
        $array = array(
            array( 'expected' => 0.013585, 'input' => "time=0.013585s;;;0.000000;10.000000", 'type' => 'float' ),
            array( 'expected' => null, 'input' => "time=;;;0.000000;10.000000", 'type' => 'null' ),
        );
        foreach ( $array as $index => $data ) {
//            echo PHP_EOL;
            $value_returned = Monitorizacion_Controller_Services::get_value_of_performance_data( $data[ 'input' ] );
//            echo ">>>" . $data['input'] . PHP_EOL;
//            echo ">>>" . $data['expected'] . PHP_EOL;
//            echo ">>>" . $value_returned . PHP_EOL;
            $this->assertEquals( $data[ 'expected' ], $value_returned, "ERROR: " . $data[ 'expected' ] . " != " . $value_returned, 0.001 );
            $this->assertInternalType( $data[ 'type' ], $value_returned );
        }
 
    }
 
    /**
     * @covers Monitorizacion_Controller::service_host_to_string
     * @group production
     * @runInSeparateProcess
     */
    public function testService_host_to_string() {
// Comparacion de fechas
        $array = array(
            Monitorizacion_Constants::SERVICIO_SSH => 'SSH',
            Monitorizacion_Constants::SERVICIO_HTTP => 'HTTP',
            Monitorizacion_Constants::SERVICIO_MYSQL => 'MYSQL',
            Monitorizacion_Constants::SERVICIO_DISCOS => 'DISK',
            Monitorizacion_Constants::SERVICIO_CPU => 'CPU',
            Monitorizacion_Constants::SERVICIO_PING => 'PING',
            -1 => null
        );
        foreach ( $array as $servicio => $value_expected ) {
            $this->assertEquals( $value_expected, Monitorizacion_Controller::service_host_to_string( $servicio ), "ERROR: $value_expected != " . Monitorizacion_Controller::service_host_to_string( $servicio ) );
        }
 
    }