Don't download MaxMind dbs in tests
Some checks failed
Deploy API / docker (17, 3.8.5) (push) Failing after 23s
Some checks failed
Deploy API / docker (17, 3.8.5) (push) Failing after 23s
This commit is contained in:
parent
f3a57dc8d9
commit
81886fa097
@ -35,8 +35,23 @@ public final class EnvironmentUtils {
|
|||||||
* Is the app running in a production environment?
|
* Is the app running in a production environment?
|
||||||
*/
|
*/
|
||||||
@Getter private static final boolean production;
|
@Getter private static final boolean production;
|
||||||
static { // Are we running on production?
|
|
||||||
|
/**
|
||||||
|
* Is the app running in a test environment?
|
||||||
|
*/
|
||||||
|
@Getter private static boolean testing;
|
||||||
|
|
||||||
|
static {
|
||||||
|
// Are we running on production?
|
||||||
String env = System.getenv("APP_ENV");
|
String env = System.getenv("APP_ENV");
|
||||||
production = env != null && (env.equals("production"));
|
production = env != null && (env.equals("production"));
|
||||||
|
|
||||||
|
// Are we running in a test?
|
||||||
|
try {
|
||||||
|
Class.forName("org.junit.Test");
|
||||||
|
testing = true;
|
||||||
|
} catch (ClassNotFoundException ignored) {
|
||||||
|
// Safely ignore
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -30,6 +30,7 @@ import jakarta.annotation.PostConstruct;
|
|||||||
import jakarta.annotation.PreDestroy;
|
import jakarta.annotation.PreDestroy;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import me.braydon.mc.common.EnvironmentUtils;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.codehaus.plexus.archiver.tar.TarGZipUnArchiver;
|
import org.codehaus.plexus.archiver.tar.TarGZipUnArchiver;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@ -70,7 +71,10 @@ public final class MaxMindService {
|
|||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
loadDatabases(); // Load the databases
|
// Load the databases
|
||||||
|
if (!EnvironmentUtils.isTesting()) {
|
||||||
|
loadDatabases();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user