package com.cameleer.server.app.runtime;

import org.junit.jupiter.api.Test;

import java.util.Map;

import static org.junit.jupiter.api.Assertions.*;

class PrometheusLabelBuilderTest {

    @Test
    void springBootLabels() {
        Map<String, String> labels = PrometheusLabelBuilder.build("spring-boot");
        assertEquals("true", labels.get("prometheus.scrape"));
        assertEquals("/actuator/prometheus", labels.get("prometheus.path"));
        assertEquals("8081", labels.get("prometheus.port"));
    }

    @Test
    void quarkusLabels() {
        Map<String, String> labels = PrometheusLabelBuilder.build("quarkus");
        assertEquals("true", labels.get("prometheus.scrape"));
        assertEquals("/q/metrics", labels.get("prometheus.path"));
        assertEquals("9000", labels.get("prometheus.port"));
    }

    @Test
    void nativeLabels() {
        Map<String, String> labels = PrometheusLabelBuilder.build("native");
        assertEquals("true", labels.get("prometheus.scrape"));
        assertEquals("/q/metrics", labels.get("prometheus.path"));
        assertEquals("9000", labels.get("prometheus.port"));
    }

    @Test
    void plainJavaLabels() {
        Map<String, String> labels = PrometheusLabelBuilder.build("plain-java");
        assertEquals("true", labels.get("prometheus.scrape"));
        assertEquals("/metrics", labels.get("prometheus.path"));
        assertEquals("9464", labels.get("prometheus.port"));
    }

    @Test
    void unknownDefaultsToSpringBoot() {
        Map<String, String> labels = PrometheusLabelBuilder.build("unknown");
        assertEquals("true", labels.get("prometheus.scrape"));
        assertEquals("/actuator/prometheus", labels.get("prometheus.path"));
        assertEquals("8081", labels.get("prometheus.port"));
    }
}
