示例#1
0
setTimeout(function() {
iisnodeassert.sequence([
iisnodeassert.get(10000, "/142_recycle_signal/hello.js", 200, "Hello, world!", function (res) {
        secondPid = res.headers['processpid'];
        console.log(secondPid);     
        assert.ok( firstPid != secondPid, 'recycle was not successful'); 
    })
]);
}, 10000);
示例#2
0
/*
When devErrorsEnabled="true", iis failures are reported as HTTP 200, otherwise 5xx
*/

var iisnodeassert = require("iisnodeassert");

iisnodeassert.sequence([
    iisnodeassert.get(10000, "/112_dev_errors/on/hello.js", 200),
    iisnodeassert.get(10000, "/112_dev_errors/off/hello.js", 500)
]);
示例#3
0
/*
Five consecutive requests are dispatched to the same node.exe process
*/

var iisnodeassert = require("iisnodeassert");

iisnodeassert.sequence([
    iisnodeassert.get(10000, "/101_helloworld_sequence/hello.js", 200, "Hello, world 1"),
    iisnodeassert.get(2000, "/101_helloworld_sequence/hello.js", 200, "Hello, world 2"),
    iisnodeassert.get(2000, "/101_helloworld_sequence/hello.js", 200, "Hello, world 3"),
    iisnodeassert.get(2000, "/101_helloworld_sequence/hello.js", 200, "Hello, world 4"),
    iisnodeassert.get(2000, "/101_helloworld_sequence/hello.js", 200, "Hello, world 5")
]);
/*
Accessing hello world service after the the *.js file has been updated
*/

var iisnodeassert = require("iisnodeassert");

iisnodeassert.sequence([
    iisnodeassert.get(10000, "/117_autoupdate_dependency/hello.js", 200, "Hello, world 2")
]);
示例#5
0
/*
A request URL without the *.js file specified picks up the index.js registered as the default document in web.config
*/

var iisnodeassert = require("iisnodeassert");

iisnodeassert.sequence([
    iisnodeassert.get(10000, "/102_defaultdocument/", 200, "[defaultdocument]")
]);
示例#6
0
/*
Four consecutive requests are dispatched to two node.exe processes following a round robin algorithm
*/

var iisnodeassert = require("iisnodeassert");

iisnodeassert.sequence([
    iisnodeassert.get(10000, "/114_roundrobin/hello.js", 200, "Hello, world 1"),
    iisnodeassert.get(2000, "/114_roundrobin/hello.js", 200, "Hello, world 1"),
    iisnodeassert.get(2000, "/114_roundrobin/hello.js", 200, "Hello, world 2"),
    iisnodeassert.get(2000, "/114_roundrobin/hello.js", 200, "Hello, world 2")
]);
示例#7
0
/*
In production environment debugging and logging are disabled and NODE_ENV is set to 'production'
*/

var iisnodeassert = require("iisnodeassert");

iisnodeassert.sequence([
    iisnodeassert.get(10000, "/111_node_env/hello.js", 200, "Hello, world! [NODE_ENV]=production"),
    iisnodeassert.get(2000, "/111_node_env/hello.js/debug", 200, "Hello, world! [NODE_ENV]=production"),
    iisnodeassert.get(2000, "/111_node_env/hello.js.logs/0.txt", 404)
]);
示例#8
0
/*
A simple GET request receives a hello world response
*/

var iisnodeassert = require("iisnodeassert")
    , assert = require('assert');

iisnodeassert.sequence([
    iisnodeassert.get(10000, "/100_helloworld/hello.js", 200, "Hello, world!", function (res) {
        assert.ok(typeof res.headers['iisnode-debug'] === 'undefined', 'iisnode-debug is absent');
    })
]);
示例#9
0
iisnodeassert.sequence([
    deleteConfig,
    iisnodeassert.get(10000, "/126_node_config_syntax/hello.js?empty", 200, "iisnode.yml updated"),
    iisnodeassert.get(10000, "/126_node_config_syntax/hello.js", 200, "Hello, world 1"),
    deleteConfig,

    iisnodeassert.get(10000, "/126_node_config_syntax/hello.js?noKey1", 200, "iisnode.yml updated"),
    iisnodeassert.get(10000, "/126_node_config_syntax/hello.js", 200, isNodeConfigError),
    deleteConfig,

    iisnodeassert.get(10000, "/126_node_config_syntax/hello.js?noKey2", 200, "iisnode.yml updated"),
    iisnodeassert.get(10000, "/126_node_config_syntax/hello.js", 200, isNodeConfigError),
    deleteConfig,

    iisnodeassert.get(10000, "/126_node_config_syntax/hello.js?emptyValue1", 200, "iisnode.yml updated"),
    iisnodeassert.get(10000, "/126_node_config_syntax/hello.js", 200, "Hello, world 1"),
    deleteConfig,

    iisnodeassert.get(10000, "/126_node_config_syntax/hello.js?emptyValue2", 200, "iisnode.yml updated"),
    iisnodeassert.get(10000, "/126_node_config_syntax/hello.js", 200, "Hello, world 1"),
    deleteConfig,

    iisnodeassert.get(10000, "/126_node_config_syntax/hello.js?unrecognizedKey", 200, "iisnode.yml updated"),
    iisnodeassert.get(10000, "/126_node_config_syntax/hello.js", 200, "Hello, world 1"),
    deleteConfig,

    iisnodeassert.get(10000, "/126_node_config_syntax/hello.js?invalidBool", 200, "iisnode.yml updated"),
    iisnodeassert.get(10000, "/126_node_config_syntax/hello.js", 200, isNodeConfigError),
    deleteConfig,

    iisnodeassert.get(10000, "/126_node_config_syntax/hello.js?emptyLine", 200, "iisnode.yml updated"),
    iisnodeassert.get(10000, "/126_node_config_syntax/hello.js", 200, "Hello, world 1"),
    deleteConfig
]);
示例#10
0
/*
Request to URLs subordinate of 'hello' get handled by the hello.js application
*/

var iisnodeassert = require("iisnodeassert");

iisnodeassert.sequence([
    iisnodeassert.get(10000, "/103_urlrewrite/hello", 200, "/103_urlrewrite/hello"),
    iisnodeassert.get(2000, "/103_urlrewrite/hello/", 200, "/103_urlrewrite/hello/"),
    iisnodeassert.get(2000, "/103_urlrewrite/hello.js", 200, "/103_urlrewrite/hello.js"),
    iisnodeassert.get(2000, "/103_urlrewrite/hello?foo=bar", 200, "/103_urlrewrite/hello?foo=bar"),
    iisnodeassert.get(2000, "/103_urlrewrite/hello/a/b/c", 200, "/103_urlrewrite/hello/a/b/c"),
    iisnodeassert.get(2000, "/103_urlrewrite/hello/a/b/c/", 200, "/103_urlrewrite/hello/a/b/c/"),
    iisnodeassert.get(2000, "/103_urlrewrite/hello/a/b?foo=bar", 200, "/103_urlrewrite/hello/a/b?foo=bar")
]);
示例#11
0
/*
Accessing hello world service after the *.js file has been updated
*/

var iisnodeassert = require("iisnodeassert");

iisnodeassert.sequence([
    iisnodeassert.get(10000, "/106_autoupdate/hello.js", 200, "Hello, world 2")
]);
示例#12
0
/*
Testing samples
*/

var iisnodeassert = require("iisnodeassert");

iisnodeassert.sequence([
    iisnodeassert.get(10000, "/node/helloworld/hello.js", 200),
    iisnodeassert.get(10000, "/node/configuration/hello.js", 200, "Hello, world! [configuration sample]"),
    iisnodeassert.get(10000, "/node/logging/hello.js", 200, "Hello, world! [logging sample]"),
    iisnodeassert.get(10000, "/node/defaultdocument/", 200, "You have reached the default node.js application at index.js! [defaultdocument sample]"),
    iisnodeassert.get(10000, "/node/express/hello/foo", 200, "Hello from foo! [express sample]"),
    iisnodeassert.get(2000, "/node/express/hello/bar", 200, "Hello from bar! [express sample]"),
    iisnodeassert.get(2000, "/node/express/hello/idonotexist", 404, "Cannot GET /node/express/hello/idonotexist"),
    iisnodeassert.get(10000, "/node/urlrewrite/hello/foo/bar/baz", 200, "Hello from urlrewrite sample. Request path: /node/urlrewrite/hello/foo/bar/baz"),
    iisnodeassert.get(2000, "/node/urlrewrite/hello/1/2/3?param=4", 200, "Hello from urlrewrite sample. Request path: /node/urlrewrite/hello/1/2/3?param=4")
]);
示例#13
0
/*
Another log file is created if log size quota is reached
*/

var iisnodeassert = require("iisnodeassert")
    , fs = require('fs')
    , path = require('path')
    , assert = require('assert');

var logDir = path.resolve(__dirname, '../www/110_log_size_quota/iisnode');
var existsSync = fs.existsSync || path.existsSync;

if (existsSync(logDir)) {
    fs.readdirSync(logDir).forEach(function (file) {
        fs.unlinkSync(path.resolve(logDir, file));
    });
}

iisnodeassert.sequence([
    iisnodeassert.get(10000, "/110_log_size_quota/hello.js", 200, "Hello, world"),
    iisnodeassert.get(2000, "/110_log_size_quota/hello.js", 200, "Hello, world"),
    function (next) {
        assert.ok(existsSync(logDir), 'log directory exists');
        var files = fs.readdirSync(logDir)
        assert.equal(files.length, 3, 'three files created in the log directory');

        if (next)
            next();
    }
]);
示例#14
0
/*
iisnode adds X-Forwarded-For header to HTTP requests when issnode\@enableXFF is true
*/

var iisnodeassert = require("iisnodeassert");

iisnodeassert.sequence([
    iisnodeassert.get(10000, "/118_xff/hello.js", 200, "Request contains X-Forwarded-For header")
]);
示例#15
0
/*
Current directory of node.exe process is set to the same location as the applications's *.js file.
*/

var iisnodeassert = require("iisnodeassert");

iisnodeassert.sequence([
    iisnodeassert.get(10000, "/107_filesystem/hello.js", 200, "Contents of a file")
]);
示例#16
0
/*
A simple test to see if recycle signal from node app worked.
*/

var iisnodeassert = require("iisnodeassert")
    , assert = require('assert');
    
var firstPid = 0;
var secondPid = 0;

iisnodeassert.sequence([
iisnodeassert.get(10000, "/142_recycle_signal/hello.js", 200, "Hello, world!", function (res) {
        firstPid = res.headers['processpid'];
        console.log(firstPid);      
    })
]);

setTimeout(function() {
iisnodeassert.sequence([
iisnodeassert.get(10000, "/142_recycle_signal/hello.js", 200, "Hello, world!", function (res) {
        secondPid = res.headers['processpid'];
        console.log(secondPid);     
        assert.ok( firstPid != secondPid, 'recycle was not successful'); 
    })
]);
}, 10000);