ni / grpc-device

gRPC server providing remote access to NI device driver APIs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Intermittent Test: NiFgenDriverApiTest.SetAttributeViBoolean_GetAttributeViBoolean_ValueMatches

maxxboehme opened this issue · comments

The following test has intermittently failed in the past: https://github.com/ni/grpc-device/actions/runs/5602661994/job/15212880954

[ RUN      ] NiFgenDriverApiTest.SetAttributeViBoolean_GetAttributeViBoolean_ValueMatches
unknown file: Failure
C++ exception with description "MAX:  (Hex 0x80040303) Internal error: The requested object was not found in the configuration database. Please note the steps you performed that led to this error and contact technical support at http://ni.com/support.

Component Name: 
File Name: 
Line Number: 0

Status Code: -2147220733" thrown in SetUp().

Possible solution to to upgrade to a 5433 similar to #951. Trying to just update the hardware results in the following test failures which would either need to be updated or if deemed not valuable enough removed.

[ RUN      ] NiFgenDriverApiTest.PerformSelfTest_CompletesSuccessfuly
C:\Users\mboehme\github\forks\grpc-device\source\tests\system\nifgen_driver_api_tests.cpp(432): error: Expected equality of these values:
  ""
  response.self_test_message()
    Which is: "Self test passed"
[  FAILED  ] NiFgenDriverApiTest.PerformSelfTest_CompletesSuccessfuly (530 ms)
[ RUN      ] NiFgenDriverApiTest.SendSoftwareEdgeTrigger_TriggersSuccessfully
C:\Users\mboehme\github\forks\grpc-device\source\tests\system\nifgen_driver_api_tests.cpp(556): error: Value of: status.ok()
  Actual: false
Expected: true
[  FAILED  ] NiFgenDriverApiTest.SendSoftwareEdgeTrigger_TriggersSuccessfully (76 ms)
[ RUN      ] NiFgenDriverApiTest.AllocateNamedWaveform_WriteNamedWaveformF64_WaveformWrittenSuccessfully
C:\Users\mboehme\github\forks\grpc-device\source\tests\system\nifgen_driver_api_tests.cpp(352): error: Value of: status.ok()
  Actual: false
Expected: true
C:\Users\mboehme\github\forks\grpc-device\source\tests\system\nifgen_driver_api_tests.cpp(368): error: Value of: status.ok()
  Actual: false
Expected: true
[  FAILED  ] NiFgenDriverApiTest.AllocateNamedWaveform_WriteNamedWaveformF64_WaveformWrittenSuccessfully (94 ms)
[ RUN      ] NiFgenDriverApiTest.AllocateWaveform_WriteWaveformComplexF64_WaveformWrittenSuccessfully
C:\Users\mboehme\github\forks\grpc-device\source\tests\system\nifgen_driver_api_tests.cpp(383): error: Value of: status.ok()
  Actual: false
Expected: true
C:\Users\mboehme\github\forks\grpc-device\source\tests\system\nifgen_driver_api_tests.cpp(404): error: Value of: status.ok()
  Actual: false
Expected: true
[  FAILED  ] NiFgenDriverApiTest.AllocateWaveform_WriteWaveformComplexF64_WaveformWrittenSuccessfully (87 ms)
[ RUN      ] NiFgenDriverApiTest.OutputModeConfiguredToSeq_CreateAdvancedArbSequenceForArbitraryWaveform_CreatesSuccessfully
C:\Users\mboehme\github\forks\grpc-device\source\tests\system\nifgen_driver_api_tests.cpp(319): error: Value of: status.ok()
  Actual: false
Expected: true
C:\Users\mboehme\github\forks\grpc-device\source\tests\system\nifgen_driver_api_tests.cpp(336): error: Value of: status.ok()
  Actual: false
Expected: true
[  FAILED  ] NiFgenDriverApiTest.OutputModeConfiguredToSeq_CreateAdvancedArbSequenceForArbitraryWaveform_CreatesSuccessfully (106 ms)
[ RUN      ] NiFgenDriverApiTest.OutputModeConfiguredToArb_CreateWaveformI16_CreatesSuccessfully
C:\Users\mboehme\github\forks\grpc-device\source\tests\system\nifgen_driver_api_tests.cpp(636): error: Value of: status.ok()
  Actual: false
Expected: true
[  FAILED  ] NiFgenDriverApiTest.OutputModeConfiguredToArb_CreateWaveformI16_CreatesSuccessfully (47 ms)

AB#2501196

A comment from that PR:

I think the error reporting in the MI driver tests needs some improvements.

  ::grpc::Status status = GetStub()->SendSoftwareEdgeTrigger(&context, request, &response);

  EXPECT_TRUE(status.ok());
  expect_api_success(response.status());

EXPECT_TRUE(status.ok()); reports whether the returned gRPC status is OK or error. This is correct, but not very descriptive. It doesn't tell you the gRPC status code (UNKNOWN, INVALID_ARGUMENT, etc.) or the error message.

expect_api_success(response.status()); checks the NI status code in the response. It also looks up the static error message for that NI status code. However, NI gRPC Device Server no longer reports errors this way: it reports errors by returning a non-OK gRPC status. This means that error cases leave the response object's status field set to 0.

I updated nidaqmx_driver_api_tests.cpp to use client::raise_if_error() for all or most API calls.

This is more helpful because it:

  1. ensures that tests don't ignore unexpected errors
  2. prints the error message (and maybe the gRPC status code, I'm not sure)