mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
ci: check if maxmind license key exists
This commit is contained in:
1 parent
238f356528
commit
5db35700f3
4 files changed
+25
-13
No files matched your search
@@ -2,11 +2,11 @@ module.exports = {
|
||||
mongodbMemoryServerOptions: {
|
||||
binary: {
|
||||
version: '4.0.3',
|
||||
skipMD5: true
|
||||
skipMD5: true,
|
||||
},
|
||||
instance: {
|
||||
dbName: 'jest'
|
||||
dbName: 'jest',
|
||||
},
|
||||
autoStart: false
|
||||
autoStart: false,
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -1,8 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -f "./GeoLite2-City.mmdb" ]; then
|
||||
wget -O ./GeoLite2-City.tar.gz "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=${LICENSE_KEY}&suffix=tar.gz"
|
||||
tar zxvf ./GeoLite2-City.tar.gz -C .
|
||||
mv ./GeoLite2-City_*/GeoLite2-City.mmdb ./GeoLite2-City.mmdb
|
||||
rm -r ./GeoLite2-City_* ./GeoLite2-City.tar.gz
|
||||
if [ -n "${LICENSE_KEY}" ]; then
|
||||
wget -O ./GeoLite2-City.tar.gz "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=${LICENSE_KEY}&suffix=tar.gz"
|
||||
tar zxvf ./GeoLite2-City.tar.gz -C .
|
||||
mv ./GeoLite2-City_*/GeoLite2-City.mmdb ./GeoLite2-City.mmdb
|
||||
rm -r ./GeoLite2-City_* ./GeoLite2-City.tar.gz
|
||||
fi
|
||||
fi
|
||||
@@ -1,11 +1,19 @@
|
||||
import 'hydrooj';
|
||||
import 'hydrooj/src/lib/i18n';
|
||||
import * as lib from '@hydrooj/geoip/lib';
|
||||
|
||||
let lib;
|
||||
try {
|
||||
lib = require('@hydrooj/geoip/lib');
|
||||
} catch (e) {
|
||||
console.warn('Maxmind db load fail');
|
||||
}
|
||||
|
||||
describe('geoip', () => {
|
||||
test('MD5', () => {
|
||||
expect(lib.lookup('127.0.0.1', 'zh_CN').display).toStrictEqual('Unknown address');
|
||||
expect(lib.lookup('1.1.1.1', 'zh-CN').display).toStrictEqual('大洋洲 澳大利亚');
|
||||
expect(lib.provider.includes('MaxMind')).toBeTruthy();
|
||||
test('lookup', () => {
|
||||
if (lib) {
|
||||
expect(lib.lookup('127.0.0.1', 'zh_CN').display).toStrictEqual('Unknown address');
|
||||
expect(lib.lookup('1.1.1.1', 'zh-CN').display).toStrictEqual('大洋洲 澳大利亚');
|
||||
expect(lib.provider.includes('MaxMind')).toBeTruthy();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -3,6 +3,8 @@ import * as bus from 'hydrooj/src/service/bus';
|
||||
import { PRIV } from 'hydrooj/src/model/builtin';
|
||||
import { connect, dispose } from './db';
|
||||
|
||||
jest.setTimeout(30000);
|
||||
|
||||
describe('Model.User', () => {
|
||||
let user: typeof import('hydrooj/src/model/user').default;
|
||||
|
||||
|
||||
Reference in new issue
Block a user