From 881c6d76a8832be0103a5e15b70d36a668b9ade1 Mon Sep 17 00:00:00 2001 From: Peter Nemere Date: Tue, 5 Nov 2024 15:08:31 +1000 Subject: [PATCH 1/4] Fix SDF->RSI converter test --- api/dataimport/sdfToRSI/sdfToRSI_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/dataimport/sdfToRSI/sdfToRSI_test.go b/api/dataimport/sdfToRSI/sdfToRSI_test.go index da706619..939a1a1f 100644 --- a/api/dataimport/sdfToRSI/sdfToRSI_test.go +++ b/api/dataimport/sdfToRSI/sdfToRSI_test.go @@ -40,9 +40,11 @@ func Example_ConvertSDFtoRSI() { } } + fmt.Printf("Mkdir output: %v", os.MkdirAll("./output", 0644)) files, rtts, err := ConvertSDFtoRSIs("./test-data/sdf_raw.txt", "./output/") fmt.Printf("%v, %v: %v\n", files, rtts, err) // Output: + // Mkdir output: // [RSI-208536069.csv RSI-208601602.csv], [208536069 208601602]: } From 82f1a1e29d13212f59032b3e7ee4231143aa4d69 Mon Sep 17 00:00:00 2001 From: Peter Nemere Date: Tue, 5 Nov 2024 15:10:35 +1000 Subject: [PATCH 2/4] Change mongo error print so failures in unit tests are easier to search for --- core/mongoDBConnection/remote.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/mongoDBConnection/remote.go b/core/mongoDBConnection/remote.go index 5eaa577f..a2549412 100644 --- a/core/mongoDBConnection/remote.go +++ b/core/mongoDBConnection/remote.go @@ -120,7 +120,7 @@ func makeMongoCommandMonitor(log logger.ILogger) *event.CommandMonitor { log.Debugf("Mongo success:\n%v", evt.CommandFinishedEvent) }, Failed: func(_ context.Context, evt *event.CommandFailedEvent) { - log.Errorf("Mongo FAIL:\n%v", evt.Failure) + log.Errorf("Mongo err:\n%v", evt.Failure) }, } } From 5b0937f672ade392ceab4e65266289e859b42ed4 Mon Sep 17 00:00:00 2001 From: Peter Nemere Date: Tue, 5 Nov 2024 15:14:46 +1000 Subject: [PATCH 3/4] Disabled broken EM tests --- api/dataimport/for-trigger_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/dataimport/for-trigger_test.go b/api/dataimport/for-trigger_test.go index b520a594..1a35644c 100644 --- a/api/dataimport/for-trigger_test.go +++ b/api/dataimport/for-trigger_test.go @@ -521,7 +521,9 @@ func Test_ImportForTrigger_Manual_SBU_NoAutoShare_FailForPipeline(t *testing.T) } } */ -// Import a breadboard dataset from manual uploaded zip file + +// DISABLED 5/Nov/2024, rewrite importer for EM to work differently so these tests are no longer relevant. Will have to write new tests for new functionality +/* func Example_importForTrigger_Manual_EM() { remoteFS, log, configBucket, datasetBucket, manualBucket, db := initTest("Manual_EM", "ManualEM_OK", specialUserIds.PIXLISESystemUserId, "PIXLFMGroupId") @@ -587,7 +589,7 @@ func Example_importForTrigger_Manual_EM_WithBeamV2() { // Logged "No auto-share destination found, so only importing user will be able to access this dataset.": false // Logged "Saving as beam geometry tool version: 2": true // |{"id":"048300551","title":"048300551","dataTypes":[{"dataType":"SD_IMAGE","count":4},{"dataType":"SD_XRF","count":242}],"instrument":"PIXL_EM","instrumentConfig":"PIXL-EM-E2E","meta":{"DriveId":"1712","RTT":"048300551","SCLK":"678031418","Site":"","SiteId":"4","Sol":"0125","Target":"","TargetId":"?"},"contentCounts":{"BulkSpectra":2,"DwellSpectra":0,"MaxSpectra":2,"NormalSpectra":242,"PseudoIntensities":121},"creatorUserId":"PIXLISEImport"} -} +}*/ /* NOT TESTED YET, because it's not done yet! From c075e98f896acfe6d36fb56e474acc9a86d07a26 Mon Sep 17 00:00:00 2001 From: Peter Nemere Date: Tue, 5 Nov 2024 15:25:28 +1000 Subject: [PATCH 4/4] Ensure sdf raw zip exists for tests to work --- api/dataimport/sdfToRSI/scanSDF_test.go | 2 ++ api/dataimport/sdfToRSI/sdfToRSI_test.go | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/api/dataimport/sdfToRSI/scanSDF_test.go b/api/dataimport/sdfToRSI/scanSDF_test.go index ee4a773d..7bd48de5 100644 --- a/api/dataimport/sdfToRSI/scanSDF_test.go +++ b/api/dataimport/sdfToRSI/scanSDF_test.go @@ -3,6 +3,8 @@ package sdfToRSI import "fmt" func Example_scanSDF() { + ensureSDFRawExists() + refs, err := scanSDF("./test-data/BadPath.txt") fmt.Printf("%v|%v\n", len(refs), err) diff --git a/api/dataimport/sdfToRSI/sdfToRSI_test.go b/api/dataimport/sdfToRSI/sdfToRSI_test.go index 939a1a1f..868451bc 100644 --- a/api/dataimport/sdfToRSI/sdfToRSI_test.go +++ b/api/dataimport/sdfToRSI/sdfToRSI_test.go @@ -9,6 +9,18 @@ import ( ) func Example_ConvertSDFtoRSI() { + ensureSDFRawExists() + + fmt.Printf("Mkdir output: %v\n", os.MkdirAll("./output", 0644)) + files, rtts, err := ConvertSDFtoRSIs("./test-data/sdf_raw.txt", "./output/") + fmt.Printf("%v, %v: %v\n", files, rtts, err) + + // Output: + // Mkdir output: + // [RSI-208536069.csv RSI-208601602.csv], [208536069 208601602]: +} + +func ensureSDFRawExists() { // If it's not here, unzip it _, err := os.Stat("./test-data/sdf_raw.txt") if err != nil { @@ -39,12 +51,4 @@ func Example_ConvertSDFtoRSI() { } } } - - fmt.Printf("Mkdir output: %v", os.MkdirAll("./output", 0644)) - files, rtts, err := ConvertSDFtoRSIs("./test-data/sdf_raw.txt", "./output/") - fmt.Printf("%v, %v: %v\n", files, rtts, err) - - // Output: - // Mkdir output: - // [RSI-208536069.csv RSI-208601602.csv], [208536069 208601602]: }