remove docker proxy from tests
this is too complicated and also makes it hard to keep up with upstream API
This commit is contained in:
@@ -20,7 +20,6 @@ var appdb = require('../../appdb.js'),
|
||||
hat = require('../../hat.js'),
|
||||
hock = require('hock'),
|
||||
http = require('http'),
|
||||
https = require('https'),
|
||||
ldap = require('../../ldap.js'),
|
||||
net = require('net'),
|
||||
nock = require('nock'),
|
||||
@@ -35,8 +34,7 @@ var appdb = require('../../appdb.js'),
|
||||
taskmanager = require('../../taskmanager.js'),
|
||||
tokendb = require('../../tokendb.js'),
|
||||
url = require('url'),
|
||||
uuid = require('uuid'),
|
||||
_ = require('underscore');
|
||||
uuid = require('uuid');
|
||||
|
||||
var SERVER_URL = 'http://localhost:' + constants.PORT;
|
||||
|
||||
@@ -76,32 +74,6 @@ var user_1_id = null;
|
||||
var token = null;
|
||||
var token_1 = null;
|
||||
|
||||
function startDockerProxy(interceptor, callback) {
|
||||
assert.strictEqual(typeof interceptor, 'function');
|
||||
|
||||
return http.createServer(function (req, res) {
|
||||
if (interceptor(req, res)) return;
|
||||
|
||||
// rejectUnauthorized should not be required but it doesn't work without it
|
||||
var options = _.extend({ }, docker.options, { method: req.method, path: req.url, headers: req.headers, rejectUnauthorized: false });
|
||||
delete options.protocol; // https module doesn't like this key
|
||||
var proto = docker.options.protocol === 'https' ? https : http;
|
||||
var dockerRequest = proto.request(options, function (dockerResponse) {
|
||||
res.writeHead(dockerResponse.statusCode, dockerResponse.headers);
|
||||
dockerResponse.on('error', console.error);
|
||||
dockerResponse.pipe(res, { end: true });
|
||||
});
|
||||
|
||||
req.on('error', console.error);
|
||||
if (!req.readable) {
|
||||
dockerRequest.end();
|
||||
} else {
|
||||
req.pipe(dockerRequest, { end: true });
|
||||
}
|
||||
|
||||
}).listen(5687, callback);
|
||||
}
|
||||
|
||||
function checkAddons(appEntry, done) {
|
||||
async.retry({ times: 15, interval: 3000 }, function (callback) {
|
||||
// this was previously written with superagent but it was getting sporadic EPIPE
|
||||
@@ -227,23 +199,6 @@ function startBox(done) {
|
||||
});
|
||||
},
|
||||
|
||||
function (callback) {
|
||||
dockerProxy = startDockerProxy(function interceptor(req, res) {
|
||||
if (req.method === 'POST' && req.url === '/images/create?fromImage=' + encodeURIComponent(TEST_IMAGE_REPO) + '&tag=' + TEST_IMAGE_TAG) {
|
||||
imageCreated = true;
|
||||
res.writeHead(200);
|
||||
res.end();
|
||||
return true;
|
||||
} else if (req.method === 'DELETE' && req.url === '/images/' + TEST_IMAGE + '?force=false&noprune=false') {
|
||||
imageDeleted = true;
|
||||
res.writeHead(200);
|
||||
res.end();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}, callback);
|
||||
},
|
||||
|
||||
function (callback) {
|
||||
process.stdout.write('Waiting for platform to be ready...');
|
||||
async.retry({ times: 500, interval: 1000 }, function (retryCallback) {
|
||||
|
||||
Reference in New Issue
Block a user