Skip to content
Snippets Groups Projects
Commit b7bc541c authored by Lars Johansson's avatar Lars Johansson
Browse files

Added docker integration test for REST API endpoint - report

parent 2c9057ec
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,7 @@ import org.testcontainers.junit.jupiter.Testcontainers;
* with docker-compose.yml / Dockerfile.
*
* <p>
* Focus of this class is Healthcheck endpoint.
* Focus of this class is healthcheck endpoint.
* In practice, it means means to have Naming and PostgreSQL up and running.
* </p>
*
......
/*
* Copyright (C) 2022 European Spallation Source ERIC.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.openepics.names.docker;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.io.IOException;
import java.net.HttpURLConnection;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.DockerComposeContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
/**
* Integration tests for Naming and PostgreSQL that make use of existing dockerization
* with docker-compose.yml / Dockerfile.
*
* <p>
* Focus of this class is report endpoint.
* </p>
*
* @author Lars Johansson
*/
@Testcontainers
class ReportIT {
@Container
public static final DockerComposeContainer<?> ENVIRONMENT =
new DockerComposeContainer<>(new File("docker-compose-integrationtest.yml"))
.waitingFor(ITUtil.NAMING, Wait.forLogMessage(".*Started NamingApplication.*", 1));
@Test
void readReportAbout() {
try {
String address = ITUtil.HTTP_IP_PORT_NAMING + "/report/about";
int responseCode = ITUtil.doGet(address);
assertEquals(HttpURLConnection.HTTP_OK, responseCode);
} catch (IOException e) {
fail();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment