Functional Testing

Shell scripts to test k8s and os conversion
which can be ran by following command in root dir
`./script/test/cmd/tests.sh`
This commit is contained in:
Suraj Deshmukh
2016-08-08 04:39:10 +00:00
parent 786f0fee9b
commit 9a4e953555
35 changed files with 2918 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
FROM centos:7
RUN yum -y install epel-release && yum install -y nodejs npm gcc* make
RUN /bin/bash -c 'npm install -g nodemon' && mkdir /src
# Define working directory
WORKDIR /src
ADD . /src
RUN cd /src && npm install
# Expose port
EXPOSE 8080
# Run app using nodemon
CMD /bin/bash -c 'nodemon /src/index.js'
+28
View File
@@ -0,0 +1,28 @@
var express = require('express'),
http = require('http'),
redis = require('redis');
var app = express();
console.log(process.env.REDIS_PORT_6379_TCP_ADDR + ':' + process.env.REDIS_PORT_6379_TCP_PORT);
// APPROACH 1: Using environment variables created by Docker
// var client = redis.createClient(
// process.env.REDIS_PORT_6379_TCP_PORT,
// process.env.REDIS_PORT_6379_TCP_ADDR
// );
// APPROACH 2: Using host entries created by Docker in /etc/hosts (RECOMMENDED)
var client = redis.createClient('6379', 'redis');
app.get('/', function(req, res, next) {
client.incr('counter', function(err, counter) {
if(err) return next(err);
res.send('This page has been viewed ' + counter + ' times!');
});
});
http.createServer(app).listen(process.env.PORT || 8080, function() {
console.log('Listening on port ' + (process.env.PORT || 8080));
});
+14
View File
@@ -0,0 +1,14 @@
{
"name": "node",
"version": "1.0.0",
"description": "",
"main": "index.js",
"author": "Anand Mani Sankar",
"license": "ISC",
"dependencies": {
"express": "^4.12.3",
"hiredis": "^0.2.0",
"mocha": "^2.2.1",
"redis": "^0.12.1"
}
}
@@ -0,0 +1,7 @@
var assert = require("assert");
describe('Dummy Test', function(){
it('should pass', function(){
assert.ok(true, "It is true!");
});
});