@@ -288,14 +288,47 @@ TEST_F(GraphCreationTest, rerankPositiveDefault) {
288
288
ASSERT_EQ (expectedRerankJsonContents, jsonContents) << jsonContents;
289
289
}
290
290
291
+ TEST_F (GraphCreationTest, rerankCreatedJsonInvalid) {
292
+ ovms::HFSettingsImpl hfSettings;
293
+ hfSettings.task = ovms::RERANK_GRAPH;
294
+ ovms::RerankGraphSettingsImpl rerankGraphSettings;
295
+ rerankGraphSettings.targetDevice = " GPU" ;
296
+ rerankGraphSettings.modelName = " myModel\t " ;
297
+ rerankGraphSettings.numStreams = 2 ;
298
+ rerankGraphSettings.maxDocLength = 18 ;
299
+ rerankGraphSettings.version = 2 ;
300
+ hfSettings.graphSettings = std::move (rerankGraphSettings);
301
+ std::string graphPath = ovms::FileSystem::appendSlash (this ->directoryPath ) + " graph.pbtxt" ;
302
+ std::string subconfigPath = ovms::FileSystem::appendSlash (this ->directoryPath ) + " subconfig.json" ;
303
+ std::unique_ptr<ovms::GraphExport> graphExporter = std::make_unique<ovms::GraphExport>();
304
+ auto status = graphExporter->createServableConfig (this ->directoryPath , hfSettings);
305
+ ASSERT_EQ (status, ovms::StatusCode::JSON_INVALID);
306
+ }
307
+
308
+ TEST_F (GraphCreationTest, rerankCreatedPbtxtInvalid) {
309
+ ovms::HFSettingsImpl hfSettings;
310
+ hfSettings.task = ovms::RERANK_GRAPH;
311
+ ovms::RerankGraphSettingsImpl rerankGraphSettings;
312
+ rerankGraphSettings.targetDevice = " GPU" ;
313
+ rerankGraphSettings.modelName = " myModel\" " ;
314
+ rerankGraphSettings.numStreams = 2 ;
315
+ rerankGraphSettings.maxDocLength = 18 ;
316
+ rerankGraphSettings.version = 2 ;
317
+ hfSettings.graphSettings = std::move (rerankGraphSettings);
318
+ std::string graphPath = ovms::FileSystem::appendSlash (this ->directoryPath ) + " graph.pbtxt" ;
319
+ std::string subconfigPath = ovms::FileSystem::appendSlash (this ->directoryPath ) + " subconfig.json" ;
320
+ std::unique_ptr<ovms::GraphExport> graphExporter = std::make_unique<ovms::GraphExport>();
321
+ auto status = graphExporter->createServableConfig (this ->directoryPath , hfSettings);
322
+ ASSERT_EQ (status, ovms::StatusCode::MEDIAPIPE_GRAPH_CONFIG_FILE_INVALID);
323
+ }
324
+
291
325
TEST_F (GraphCreationTest, embeddingsPositiveDefault) {
292
326
ovms::HFSettingsImpl hfSettings;
293
327
hfSettings.task = ovms::EMBEDDINGS_GRAPH;
294
328
ovms::EmbeddingsGraphSettingsImpl embeddingsGraphSettings;
295
329
embeddingsGraphSettings.targetDevice = " GPU" ;
296
330
embeddingsGraphSettings.modelName = " myModel" ;
297
331
embeddingsGraphSettings.numStreams = 2 ;
298
- embeddingsGraphSettings.truncate = " true" ;
299
332
embeddingsGraphSettings.normalize = " true" ;
300
333
embeddingsGraphSettings.version = 2 ;
301
334
hfSettings.graphSettings = std::move (embeddingsGraphSettings);
@@ -312,6 +345,40 @@ TEST_F(GraphCreationTest, embeddingsPositiveDefault) {
312
345
ASSERT_EQ (expectedEmbeddingsJsonContents, jsonContents) << jsonContents;
313
346
}
314
347
348
+ TEST_F (GraphCreationTest, embeddingsCreatedJsonInvalid) {
349
+ ovms::HFSettingsImpl hfSettings;
350
+ hfSettings.task = ovms::EMBEDDINGS_GRAPH;
351
+ ovms::EmbeddingsGraphSettingsImpl embeddingsGraphSettings;
352
+ embeddingsGraphSettings.targetDevice = " GPU" ;
353
+ embeddingsGraphSettings.modelName = " myModel\t " ;
354
+ embeddingsGraphSettings.numStreams = 2 ;
355
+ embeddingsGraphSettings.normalize = " true" ;
356
+ embeddingsGraphSettings.version = 2 ;
357
+ hfSettings.graphSettings = std::move (embeddingsGraphSettings);
358
+ std::string graphPath = ovms::FileSystem::appendSlash (this ->directoryPath ) + " graph.pbtxt" ;
359
+ std::string subconfigPath = ovms::FileSystem::appendSlash (this ->directoryPath ) + " subconfig.json" ;
360
+ std::unique_ptr<ovms::GraphExport> graphExporter = std::make_unique<ovms::GraphExport>();
361
+ auto status = graphExporter->createServableConfig (this ->directoryPath , hfSettings);
362
+ ASSERT_EQ (status, ovms::StatusCode::JSON_INVALID);
363
+ }
364
+
365
+ TEST_F (GraphCreationTest, embeddingsCreatedPbtxtInvalid) {
366
+ ovms::HFSettingsImpl hfSettings;
367
+ hfSettings.task = ovms::EMBEDDINGS_GRAPH;
368
+ ovms::EmbeddingsGraphSettingsImpl embeddingsGraphSettings;
369
+ embeddingsGraphSettings.targetDevice = " GPU" ;
370
+ embeddingsGraphSettings.modelName = " myModel\" " ;
371
+ embeddingsGraphSettings.numStreams = 2 ;
372
+ embeddingsGraphSettings.normalize = " true" ;
373
+ embeddingsGraphSettings.version = 2 ;
374
+ hfSettings.graphSettings = std::move (embeddingsGraphSettings);
375
+ std::string graphPath = ovms::FileSystem::appendSlash (this ->directoryPath ) + " graph.pbtxt" ;
376
+ std::string subconfigPath = ovms::FileSystem::appendSlash (this ->directoryPath ) + " subconfig.json" ;
377
+ std::unique_ptr<ovms::GraphExport> graphExporter = std::make_unique<ovms::GraphExport>();
378
+ auto status = graphExporter->createServableConfig (this ->directoryPath , hfSettings);
379
+ ASSERT_EQ (status, ovms::StatusCode::MEDIAPIPE_GRAPH_CONFIG_FILE_INVALID);
380
+ }
381
+
315
382
TEST_F (GraphCreationTest, positivePluginConfigAll) {
316
383
ovms::HFSettingsImpl hfSettings;
317
384
ovms::TextGenGraphSettingsImpl graphSettings;
@@ -377,3 +444,16 @@ TEST_F(GraphCreationTest, negativeGraphOptionsNotInitialized) {
377
444
status = graphExporter->createServableConfig (this ->directoryPath , hfSettings);
378
445
ASSERT_EQ (status, ovms::StatusCode::OK) << status.string ();
379
446
}
447
+
448
+ TEST_F (GraphCreationTest, negativeCreatedPbtxtInvalid) {
449
+ ovms::HFSettingsImpl hfSettings;
450
+ hfSettings.task = ovms::TEXT_GENERATION_GRAPH;
451
+ ovms::TextGenGraphSettingsImpl graphSettings;
452
+ graphSettings.modelPath = " invalid\" " ;
453
+ hfSettings.graphSettings = std::move (graphSettings);
454
+ std::string graphPath = ovms::FileSystem::appendSlash (this ->directoryPath ) + " graph.pbtxt" ;
455
+ std::string subconfigPath = ovms::FileSystem::appendSlash (this ->directoryPath ) + " subconfig.json" ;
456
+ std::unique_ptr<ovms::GraphExport> graphExporter = std::make_unique<ovms::GraphExport>();
457
+ auto status = graphExporter->createServableConfig (this ->directoryPath , hfSettings);
458
+ ASSERT_EQ (status, ovms::StatusCode::MEDIAPIPE_GRAPH_CONFIG_FILE_INVALID);
459
+ }
0 commit comments