Skip to content

Commit

Permalink
test separation for compression
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Jun 21, 2018
1 parent eb48627 commit 6128920
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 48 deletions.
2 changes: 1 addition & 1 deletion test/conf.js
Expand Up @@ -4,7 +4,7 @@ let baseConfig = {
user: "root",
database: "testn",
host: "localhost",
port: 3306,
port: 3308,
trace: true
};

Expand Down
62 changes: 16 additions & 46 deletions test/integration/test-big-query.js
Expand Up @@ -26,11 +26,11 @@ describe("Big query", function() {
it("parameter bigger than 16M packet size", function(done) {
if (maxAllowedSize <= testSize) this.skip();
this.timeout(10000); //can take some time
shareConn.query("CREATE TEMPORARY TABLE bigParameter (b longblob)");
shareConn.query("CREATE TEMPORARY TABLE bigParameterBigParam (b longblob)");
shareConn
.query("insert into bigParameter(b) values(?)", [buf])
.query("insert into bigParameterBigParam(b) values(?)", [buf])
.then(() => {
return shareConn.query("SELECT * from bigParameter");
return shareConn.query("SELECT * from bigParameterBigParam");
})
.then(rows => {
assert.deepEqual(rows[0].b, buf);
Expand Down Expand Up @@ -59,22 +59,23 @@ describe("Big query", function() {
});

it("buffer growing", function(done) {
if (maxAllowedSize <= 11 * 1024 * 1024) this.skip();
this.timeout(10000); //can take some time
base
.createConnection()
.then(conn => {
bufferGrowing(conn, err => {
if (err) {
done(err);
} else {
base
.createConnection({ compress: true })
.then(conn => {
bufferGrowing(conn, done);
})
.catch(done);
}
});
bufferGrowing(conn, done);
})
.catch(done);
});

it("buffer growing compression", function(done) {
if (maxAllowedSize <= 11 * 1024 * 1024) this.skip();
this.timeout(10000); //can take some time
base
.createConnection({ compress: true })
.then(conn => {
bufferGrowing(conn, done);
})
.catch(done);
});
Expand Down Expand Up @@ -108,35 +109,4 @@ describe("Big query", function() {
.catch(done);
}

it("buffer growing", function(done) {
this.timeout(10000); //can take some time
base.createConnection().then(conn => {
const st = Buffer.alloc(65536, "0").toString();
const st2 = Buffer.alloc(1048576, "0").toString();
const params = [st];
let sql = "CREATE TEMPORARY TABLE bigParameter (a0 MEDIUMTEXT ";
let sqlInsert = "insert into bigParameter values (?";
for (let i = 1; i < 10; i++) {
sql += ",a" + i + " MEDIUMTEXT ";
sqlInsert += ",?";
params.push(i < 4 ? st : st2);
}
sql += ")";
sqlInsert += ")";
conn.query(sql);
conn
.query(sqlInsert, params)
.then(() => {
return conn.query("SELECT * from bigParameter");
})
.then(rows => {
for (let i = 0; i < 10; i++) {
assert.deepEqual(rows[0]["a" + i], params[i]);
}
conn.end();
done();
})
.catch(done);
});
});
});
2 changes: 1 addition & 1 deletion test/integration/test-debug.js
Expand Up @@ -162,7 +162,7 @@ describe("debug", () => {
process.stderr.write = initialStdErr;
const serverVersion = conn.serverVersion();

const rangeWithEOF = compress ? [3800, 4470] : [2700, 4430];
const rangeWithEOF = compress ? [3000, 4470] : [2700, 4430];
const rangeWithoutEOF = compress ? [3700, 4470] : [3500, 4390];
if (
(conn.isMariaDB() && conn.hasMinVersion(10, 2, 2)) ||
Expand Down

0 comments on commit 6128920

Please sign in to comment.