Skip to content

Commit abc64bf

Browse files
committed
Fix CI test
1 parent e3c2d7d commit abc64bf

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

src/test/java/com/github/tadayosi/torchserve/client/InferenceTest.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,40 @@
1313
import static org.junit.jupiter.api.Assertions.assertThrows;
1414

1515
@Testcontainers
16-
class InferenceTest extends TorchServeTestSupport {
16+
public class InferenceTest extends TorchServeTestSupport {
1717

1818
private static final String DEFAULT_MODEL = "squeezenet1_1";
1919
private static final String DEFAULT_MODEL_VERSION = "1.0";
2020
private static final String TEST_DATA = "src/test/resources/data/kitten.jpg";
2121

2222
@Test
23-
void testApiDescription() throws Exception {
23+
public void testApiDescription() throws Exception {
2424
var response = client.inference().apiDescription();
2525
assertNotNull(response);
2626
}
2727

2828
@Test
29-
void testPing() throws Exception {
29+
public void testPing() throws Exception {
3030
var response = client.inference().ping();
3131
assertEquals("Healthy", response.getStatus());
3232
}
3333

3434
@Test
35-
void testPredictions() throws Exception {
35+
public void testPredictions() throws Exception {
3636
var body = Files.readAllBytes(Path.of(TEST_DATA));
3737
var response = client.inference().predictions(DEFAULT_MODEL, body);
3838
assertInstanceOf(Map.class, response);
3939
}
4040

4141
@Test
42-
void testPredictions_version() throws Exception {
42+
public void testPredictions_version() throws Exception {
4343
var body = Files.readAllBytes(Path.of(TEST_DATA));
4444
var response = client.inference().predictions(DEFAULT_MODEL, DEFAULT_MODEL_VERSION, body);
4545
assertInstanceOf(Map.class, response);
4646
}
4747

4848
@Test
49-
void testExplanations() {
49+
public void testExplanations() {
5050
assertThrows(UnsupportedOperationException.class, () -> client.inference().explanations(DEFAULT_MODEL));
5151
}
5252

src/test/java/com/github/tadayosi/torchserve/client/ManagementTest.java

+14-14
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import static org.junit.jupiter.api.Assertions.fail;
2323

2424
@Testcontainers
25-
class ManagementTest extends TorchServeTestSupport {
25+
public class ManagementTest extends TorchServeTestSupport {
2626

2727
private static final String DEFAULT_MODEL = "squeezenet1_1";
2828
private static final String DEFAULT_MODEL_VERSION = "1.0";
@@ -31,7 +31,7 @@ class ManagementTest extends TorchServeTestSupport {
3131
private static final String TEST_DATA_DIR = "src/test/resources/data";
3232

3333
@Test
34-
void testRegisterModel() throws Exception {
34+
public void testRegisterModel() throws Exception {
3535
var url = "https://torchserve.pytorch.org/mar_files/mnist_v2.mar";
3636
try {
3737
var response = client.management().registerModel(url, RegisterModelOptions.empty());
@@ -46,7 +46,7 @@ void testRegisterModel() throws Exception {
4646
class AfterRegisteringModel {
4747

4848
@BeforeEach
49-
void registerModel() throws Exception {
49+
public void registerModel() throws Exception {
5050
var url = "https://torchserve.pytorch.org/mar_files/mnist_v2.mar";
5151
try {
5252
client.management().registerModel(url, RegisterModelOptions.empty());
@@ -56,13 +56,13 @@ void registerModel() throws Exception {
5656
}
5757

5858
@Test
59-
void testUnregisterModel() throws Exception {
59+
public void testUnregisterModel() throws Exception {
6060
var response = client.management().unregisterModel(ADDED_MODEL, UnregisterModelOptions.empty());
6161
assertTrue(response.getStatus().contains("unregistered"));
6262
}
6363

6464
@Test
65-
void testUnregisterModel_version() throws Exception {
65+
public void testUnregisterModel_version() throws Exception {
6666
var response = client.management().unregisterModel(ADDED_MODEL, ADDED_MODEL_VERSION, UnregisterModelOptions.empty());
6767
assertTrue(response.getStatus().contains("unregistered"));
6868
}
@@ -71,12 +71,12 @@ void testUnregisterModel_version() throws Exception {
7171
class BeforeUnregisteringModel {
7272

7373
@AfterEach
74-
void unregisterModel() throws Exception {
74+
public void unregisterModel() throws Exception {
7575
client.management().unregisterModel(ADDED_MODEL, UnregisterModelOptions.empty());
7676
}
7777

7878
@Test
79-
void testSetAutoScale() throws Exception {
79+
public void testSetAutoScale() throws Exception {
8080
var response1 = client.management().setAutoScale(ADDED_MODEL,
8181
SetAutoScaleOptions.builder()
8282
.minWorker(1)
@@ -92,7 +92,7 @@ void testSetAutoScale() throws Exception {
9292
}
9393

9494
@Test
95-
void testSetAutoScale_version() throws Exception {
95+
public void testSetAutoScale_version() throws Exception {
9696
var response1 = client.management().setAutoScale(ADDED_MODEL, ADDED_MODEL_VERSION,
9797
SetAutoScaleOptions.builder()
9898
.minWorker(1)
@@ -109,22 +109,22 @@ void testSetAutoScale_version() throws Exception {
109109
}
110110

111111
@Test
112-
void testDescribeModel() throws Exception {
112+
public void testDescribeModel() throws Exception {
113113
var response = client.management().describeModel(DEFAULT_MODEL);
114114
assertEquals(1, response.size());
115115
assertEquals("squeezenet1_1", response.get(0).getModelName());
116116
}
117117

118118
@Test
119-
void testDescribeModel_version() throws Exception {
119+
public void testDescribeModel_version() throws Exception {
120120
var response = client.management().describeModel(DEFAULT_MODEL, DEFAULT_MODEL_VERSION);
121121
assertEquals(1, response.size());
122122
assertEquals("squeezenet1_1", response.get(0).getModelName());
123123
assertEquals("1.0", response.get(0).getModelVersion());
124124
}
125125

126126
@Test
127-
void testListModels() throws Exception {
127+
public void testListModels() throws Exception {
128128
int limit = 10;
129129
String nextPageToken = null;
130130
var response = client.management().listModels(limit, nextPageToken);
@@ -134,19 +134,19 @@ void testListModels() throws Exception {
134134
}
135135

136136
@Test
137-
void testSetDefault() throws Exception {
137+
public void testSetDefault() throws Exception {
138138
var response = client.management().setDefault(DEFAULT_MODEL, DEFAULT_MODEL_VERSION);
139139
assertTrue(response.getStatus().contains("Default vesion succsesfully updated"));
140140
}
141141

142142
@Test
143-
void testApiDescription() throws Exception {
143+
public void testApiDescription() throws Exception {
144144
var response = client.management().apiDescription();
145145
assertEquals("TorchServe APIs", response.getInfo().get("title"));
146146
}
147147

148148
@Test
149-
void testToken() throws Exception {
149+
public void testToken() throws Exception {
150150
assertThrows(UnsupportedOperationException.class, () -> client.management().token("management"));
151151
}
152152

src/test/java/com/github/tadayosi/torchserve/client/MetricsTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
import static org.junit.jupiter.api.Assertions.assertNotNull;
77

88
@Testcontainers
9-
class MetricsTest extends TorchServeTestSupport {
9+
public class MetricsTest extends TorchServeTestSupport {
1010

1111
@Test
12-
void testMetrics() throws Exception {
12+
public void testMetrics() throws Exception {
1313
var response = client.metrics().metrics();
1414
assertNotNull(response);
1515
}

src/test/java/com/github/tadayosi/torchserve/client/TorchServeTestSupport.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
import org.testcontainers.utility.DockerImageName;
88
import org.testcontainers.utility.MountableFile;
99

10-
class TorchServeTestSupport {
10+
public class TorchServeTestSupport {
1111

1212
private static final String IMAGE_NAME = "aarch64".equals(System.getProperty("os.arch")) ? "tadayosi/torchserve" : "pytorch/torchserve";
1313

1414
@Container
15-
static GenericContainer<?> torchServe = new GenericContainer<>(DockerImageName.parse(IMAGE_NAME))
15+
public static GenericContainer<?> torchServe = new GenericContainer<>(DockerImageName.parse(IMAGE_NAME))
1616
.withExposedPorts(8080, 8081, 8082)
1717
.withCopyFileToContainer(MountableFile.forClasspathResource("torchserve/config.properties"), "/home/model-server/config.properties")
1818
.withCopyFileToContainer(MountableFile.forClasspathResource("models/squeezenet1_1.mar"), "/home/model-server/model-store/squeezenet1_1.mar")
@@ -22,7 +22,7 @@ class TorchServeTestSupport {
2222
protected TorchServeClient client;
2323

2424
@BeforeEach
25-
void setUp() {
25+
public void setUp() {
2626
client = TorchServeClient.builder()
2727
.inferencePort(torchServe.getMappedPort(8080))
2828
.managementPort(torchServe.getMappedPort(8081))

0 commit comments

Comments
 (0)