Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import edu.wpi.first.cscore.UsbCameraInfo;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Collection;
import java.util.List;
import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
Expand All @@ -43,7 +45,7 @@
import org.photonvision.vision.pipeline.ReflectivePipelineSettings;

public class SQLConfigTest {
@TempDir private static Path tmpDir;
@TempDir private Path tmpDir;

@BeforeAll
public static void init() {
Expand Down Expand Up @@ -91,11 +93,15 @@ public void testLoad() {
}

@Test
public void testLoad2024_3_1() {
var cfgLoader =
new SqlConfigProvider(
TestUtils.getConfigDirectoriesPath(false)
.resolve("photonvision_config_from_v2024.3.1"));
public void testLoad2024_3_1() throws IOException {
// Copy the 2024.3.1 config to a temp dir
FileUtils.copyDirectory(
TestUtils.getConfigDirectoriesPath(false)
.resolve("photonvision_config_from_v2024.3.1")
.toFile(),
tmpDir.resolve("photonvision_config_from_v2024.3.1").toFile());

var cfgLoader = new SqlConfigProvider(tmpDir.resolve("photonvision_config_from_v2024.3.1"));

assertDoesNotThrow(cfgLoader::load);

Expand Down Expand Up @@ -128,8 +134,12 @@ void common2025p3p1Assertions(PhotonConfiguration config) {
}

@Test
public void testLoadNewNNMM() throws JsonProcessingException {
var folder = TestUtils.getConfigDirectoriesPath(false).resolve("2025.3.1-old-nnmm");
public void testLoadNewNNMM() throws JsonProcessingException, IOException {
var folder = tmpDir.resolve("2025.3.1-old-nnmm");
FileUtils.copyDirectory(
TestUtils.getConfigDirectoriesPath(false).resolve("2025.3.1-old-nnmm").toFile(),
folder.toFile());

var cfgManager = new ConfigManager(folder, new SqlConfigProvider(folder));

// Replace global configmanager
Expand Down Expand Up @@ -161,8 +171,12 @@ public void testLoadNewNNMM() throws JsonProcessingException {
}

@Test
public void testMaxDetectionsMigration() {
var folder = TestUtils.getConfigDirectoriesPath(false).resolve("2025.3.1-old-nnmm");
public void testMaxDetectionsMigration() throws IOException {
var folder = tmpDir.resolve("2025.3.1-old-nnmm");
FileUtils.copyDirectory(
TestUtils.getConfigDirectoriesPath(false).resolve("2025.3.1-old-nnmm").toFile(),
folder.toFile());

var cfgManager = new ConfigManager(folder, new SqlConfigProvider(folder));

// Replace global configmanager
Expand Down
Loading