mirror of
https://github.com/azures04/crafatar.git
synced 2026-03-21 23:41:18 +01:00
Fix Travis, closes #7
This commit is contained in:
parent
8e4247bb22
commit
0862cb8474
@ -2,6 +2,9 @@ language: node_js
|
|||||||
node_js:
|
node_js:
|
||||||
- "0.10"
|
- "0.10"
|
||||||
notifications:
|
notifications:
|
||||||
irc: "irc.esper.net#spongy"
|
irc:
|
||||||
|
channels:
|
||||||
|
- "irc.esper.net#spongy"
|
||||||
|
skip_join: true
|
||||||
services:
|
services:
|
||||||
- redis-server
|
- redis-server
|
||||||
@ -25,6 +25,10 @@ function connect_redis() {
|
|||||||
|
|
||||||
var exp = {};
|
var exp = {};
|
||||||
|
|
||||||
|
exp.get_redis = function() {
|
||||||
|
return redis;
|
||||||
|
};
|
||||||
|
|
||||||
// sets the timestamp for +uuid+ to now
|
// sets the timestamp for +uuid+ to now
|
||||||
exp.update_timestamp = function(uuid) {
|
exp.update_timestamp = function(uuid) {
|
||||||
console.log(uuid + " cache: updating timestamp");
|
console.log(uuid + " cache: updating timestamp");
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node server.js",
|
"start": "node server.js",
|
||||||
"test": "node_modules/.bin/mocha -w"
|
"test": "node_modules/.bin/mocha"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"express": "~4.9.0",
|
"express": "~4.9.0",
|
||||||
@ -32,7 +32,7 @@
|
|||||||
"jade": "~1.6.0",
|
"jade": "~1.6.0",
|
||||||
"lwip": "0.0.5",
|
"lwip": "0.0.5",
|
||||||
"request": "2.45.0",
|
"request": "2.45.0",
|
||||||
"redis": " 0.12.1",
|
"redis": "0.12.1",
|
||||||
"mocha": "2.0.1"
|
"mocha": "2.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8,5 +8,5 @@ for uuid in `cat "$dir/uuids.txt"`; do
|
|||||||
if [ "$(( ((RANDOM<<15)|RANDOM) % 2 ))" -eq "1" ]; then
|
if [ "$(( ((RANDOM<<15)|RANDOM) % 2 ))" -eq "1" ]; then
|
||||||
helm="&helm"
|
helm="&helm"
|
||||||
fi
|
fi
|
||||||
curl -sS -o /dev/null -w "%{url_effective} %{http_code} %{time_total}s\\n" "http://127.0.0.1:3000/avatars/$uuid?size=$size$helm" || exit 1
|
curl -sS -o /dev/null -w "%{url_effective} %{http_code} %{time_total}s\\n" "http://crafatar.com/avatars/$uuid?size=$size$helm" || exit 1
|
||||||
done
|
done
|
||||||
|
|||||||
@ -5,15 +5,15 @@ var networking = require('../modules/networking');
|
|||||||
var helpers = require('../modules/helpers');
|
var helpers = require('../modules/helpers');
|
||||||
var config = require('../modules/config');
|
var config = require('../modules/config');
|
||||||
var skins = require('../modules/skins');
|
var skins = require('../modules/skins');
|
||||||
var redis = require("redis").createClient();
|
var cache = require("../modules/cache");
|
||||||
|
|
||||||
var uuids = fs.readFileSync('test/uuids.txt').toString().split("\r\n");
|
var uuids = fs.readFileSync('test/uuids.txt').toString().split("\r\n");
|
||||||
// Get a random UUID in order to prevent rate limiting
|
// Get a random UUID in order to prevent rate limiting
|
||||||
var uuid = uuids[Math.floor(Math.random() * uuids.length)];
|
var uuid = uuids[Math.floor((Math.random() * 200) + 1)];
|
||||||
|
|
||||||
describe('Avatar Serving', function(){
|
describe('Avatar Serving', function(){
|
||||||
before(function() {
|
before(function() {
|
||||||
redis.flushall();
|
cache.get_redis().flushall();
|
||||||
});
|
});
|
||||||
describe('UUID', function(){
|
describe('UUID', function(){
|
||||||
it("should be an invalid uuid", function(done){
|
it("should be an invalid uuid", function(done){
|
||||||
@ -41,7 +41,7 @@ describe('Avatar Serving', function(){
|
|||||||
});
|
});
|
||||||
describe('Mojang Errors', function(){
|
describe('Mojang Errors', function(){
|
||||||
before(function() {
|
before(function() {
|
||||||
redis.flushall();
|
cache.get_redis().flushall();
|
||||||
});
|
});
|
||||||
it("should be rate limited", function(done) {
|
it("should be rate limited", function(done) {
|
||||||
helpers.get_avatar(uuid, false, 180, function(err, status, image) {
|
helpers.get_avatar(uuid, false, 180, function(err, status, image) {
|
||||||
|
|||||||
7
test/valid_uuids.txt
Normal file
7
test/valid_uuids.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
00fae87bdb94428eb518184877ba04d7
|
||||||
|
00ed2604df0a4d998b16ead25381aeab
|
||||||
|
00f676c99dd74ce4a1bb010c6005a912
|
||||||
|
00d9c689dd2e4b1d8ca8b11c7982e62a
|
||||||
|
00c73b58032a4881a74564734efcd6e5
|
||||||
|
0096895569fb44a7a19e18d9ecd913f0
|
||||||
|
008c93d8976d48828f502bb237dbe9ef
|
||||||
Loading…
x
Reference in New Issue
Block a user