Skip to content

Commit

Permalink
Automation of router tests
Browse files Browse the repository at this point in the history
-- run the router test
-- analyze the results
-- copy them to pbench server
-- generate graphs for the results
  • Loading branch information
schituku committed Oct 1, 2018
1 parent 244dab1 commit eb6f74f
Show file tree
Hide file tree
Showing 25 changed files with 6,249 additions and 0 deletions.
21 changes: 21 additions & 0 deletions application_performance/osperf-analyzer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Analyzer parses the data in the input files to prep them for drawing graphs.
In the process files are created in the output directory.
The following files can be analyzed and graphed:
-- rsyslog cpu or memory
-- journald cpu or memory
-- router total hits
-- router hits per sec

Input files have to be of the format
CONDITION_<<MEASURABLE>>.csv
valid measurables (which is case insensitive) with examples are given below:
WITH_MM_1_500_20_CPU.csv
WITHOUT_MM_1_1000_20_MEMORY.csv
results-routerperf-total-hits.csv
results-routerperf-hits-per-sec.csv

The results directory will have the graphs drawn on the data in the input files.

Steps to run:
from osperf-analyser folder run:
mvn test
1 change: 1 addition & 0 deletions application_performance/osperf-analyzer/input/ABOUT
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Input folder is where the input files for which the graphs need to be drawn are placed.
1 change: 1 addition & 0 deletions application_performance/osperf-analyzer/output/ABOUT
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Output folder is the place where the processed input files are placed which will be used to draw graphs
145 changes: 145 additions & 0 deletions application_performance/osperf-analyzer/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.redhat.os.svt</groupId>
<artifactId>osperf-analyzer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>osperf-analyzer</name>
<url>https://www.openshift.com/</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<final-name>osperf-analyzer</final-name>
<compiler-plugin-version>3.1</compiler-plugin-version>
<maven-surefire-plugin-version>2.19.1</maven-surefire-plugin-version>
<maven-failsafe-plugin-version>2.19.1</maven-failsafe-plugin-version>
<jdk-version>1.7</jdk-version>
<slf4j-version>1.7.7</slf4j-version>
<apache-commons-version>1.3</apache-commons-version>
<logback-classic-version>1.1.2</logback-classic-version>
<jmeter-maven-plugin-version>1.10.1</jmeter-maven-plugin-version>
<jmeter-analysis-maven-plugin-version>1.0.6</jmeter-analysis-maven-plugin-version>
<testng-version>6.9.8</testng-version>
<Jmeter-main-version>2.13</Jmeter-main-version>
<Jmeter-report-version>2.12</Jmeter-report-version>
<snakeyaml-version>1.16</snakeyaml-version>
<jfreechart-version>1.0.15</jfreechart-version>
</properties>

<build>
<finalName>${final-name}</finalName>
<resources>
<resource>
<directory>src/main/config/log</directory>
</resource>
<resource>
<directory>src/main/config/test</directory>
</resource>
<resource>
<directory>src/main/config/analyzer</directory>
</resource>
<!-- <resource> <directory>src/main/config/configurationInternal</directory>
</resource> -->
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin-version}</version>
<configuration>
<source>${jdk-version}</source>
<target>${jdk-version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin-version}</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/main/config/test/preperftests.xml</suiteXmlFile>
</suiteXmlFiles>
<properties>
<property>
<name>usedefaultlisteners</name>
<value>true</value>
</property>
</properties>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin-version}</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/main/config/test/postperftests.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- start test frameworks -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng-version}</version>
<scope>test</scope>
</dependency>

<!-- end test frameworks -->

<!-- start log frameworks -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback-classic-version}</version>
<scope>runtime</scope>
</dependency>
<!-- end log frameworks -->

<!-- start other -->
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>${snakeyaml-version}</version>
</dependency>

<!-- end other -->
<!-- start chart libraries -->
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>${jfreechart-version}</version>
</dependency>
<!-- end chart libraries -->
<!-- start apache helpful tools -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>${apache-commons-version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<!-- end apache tools -->
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@


testParameters:
- filePath: app1
fileURL: http://nodejs-mongodb-example-nodejs-mongodb0.apps.0405-o22.qe.rhcloud.com
numberOfUsers: [10]
rampUpTime: [5]
numberOfUserLoops: [ 1 ]
numberOfAppLoops: [10, 20]
intervalBetweenAppHits: [500]
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration [ ]>
<configuration>
<jmxConfigurator />
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${HOME}/logs/os-perf.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- rollover daily -->
<fileNamePattern>${HOME}/logs/osperf-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 100MB -->
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder
by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>

<appender name="CLASSFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${HOME}/logs/osperfCode.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- rollover daily -->
<fileNamePattern>${HOME}/logs/osperfCode-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 100MB -->
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder
by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>

<logger name="com.redhat.os.svt.osperf" level="DEBUG" >
<appender-ref ref="CLASSFILE" />
</logger>

<root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="SuitePostPerfTests">
<test name="PostPerfTests">
<classes>
<class name="com.redhat.os.svt.osperf.tests.PostPerfTests" />
</classes>
</test>
</suite>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="SuitePrePerfTests">
<test name="PrePerfTests">
<classes>
<class name="com.redhat.os.svt.osperf.tests.PrePerfTests" />
</classes>
</test>
</suite>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.redhat.os.svt.osperf.analyzer;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.redhat.os.svt.osperf.analyzer.support.configuration.AppPerfConfig;

public class CSVDataFile {

private static final Logger LOG = LoggerFactory.getLogger(CSVDataFile.class);

public static void scrubFileHeaders(File testFile) {
try {
List<String> lines = FileUtils.readLines(testFile, "UTF-8");
LOG.debug("The content of the line in file "+testFile.getAbsolutePath()+" are:");
LOG.debug(lines.get(0));
String[] headers = lines.get(0).split(",");
StringBuffer newHeaderLine=new StringBuffer();
String[] processNames = { AppPerfConfig.PROCESS_RSYSLOGD, AppPerfConfig.PROCESS_JOURNALD };
for (int i = 0; i < processNames.length; i++) {
newHeaderLine = new StringBuffer();
for (String header : headers) {
// LOG.debug(header+" "+processNames[i]);
if (header.contains(processNames[i])) {
header = processNames[i];
}
newHeaderLine.append(header).append(",");
}
headers = newHeaderLine.toString().split(",");
}
lines.remove(0);
List<String> newlines = new ArrayList<String>();
LOG.debug("== the new line is ==");
LOG.debug(newHeaderLine.toString());
newlines.add(newHeaderLine.toString());
for (String line : lines) {
newlines.add(line);
}
String newFileName = AppPerfConfig.TEST_OUTPUT_FILES_DIRECTORY + testFile.getName();
FileUtils.writeLines(new File(newFileName), newlines);
} catch (IOException e) {
e.printStackTrace();
}
}
}
Loading

0 comments on commit eb6f74f

Please sign in to comment.