FirebirdSQL / NETProvider

Firebird ADO.NET Data Provider
https://www.firebirdsql.org/en/net-provider/
Other
152 stars 63 forks source link

How to config Firebird Client Test for embedded #1118

Closed BFuerchau closed 11 months ago

BFuerchau commented 1 year ago

Sorry for put a question here. I have installed the FB 4.0 on my machine, but i have trouble to run the test with "embedded".

I get the follwoing Error:

267) Error : FirebirdSql.Data.FirebirdClient.Tests.FbDecFloat34SupportTests(Embedded,False,Disabled).SimpleSelectSchemaTableTest FirebirdSql.Data.FirebirdClient.FbException : Database is probably already opened by another engine instance in another Windows session ----> FirebirdSql.Data.Common.IscException

So i can not full test my pull requests.

Environment: I have actually installed the Firebird's 2.5, 3.0, and 4.0 with different ports. For the test i stop the service of 2.5 and 3.0. In the FbTestsSetup i set the Port to 3056 for the FB 4.0 Server. Because FB 4.0 has no embedded.dll and the installation is made manual i changed the

BuildConnectionStringBuilder with: if (serverType == FbServerType.Embedded) { builder.ClientLibrary = "D:\\Downloads\\Firebird\\Firebird-4.0.2.2816-0-x64\\fbclient.dll"; } Tests started with embedded works well, the database is created and opend. But starting with the test "FirebirdSql.Data.FirebirdClient.Tests.FbDecFloat34SupportTests(Embedded,False,Disabled).SimpleSelectSchemaTableTest" all remaing tests will fail with the same error.

I don't believe, that this has to do with my changes. Any suggestion?

cincuranet commented 1 year ago

That looks like the DB is created/opened using server and later accessed by embedded.

BTW you can run tests using tests.ps1. Set tests_firebird_dir environment variable to some directory where Firebird should be downloaded.

BFuerchau commented 1 year ago

The script make the test more complicated for me.

For the test: So may be a close of database runs to late when the open of the embedded is done? The tests are running automatically and i don't know, if tests are running in parallel. Hm, i will try to stop the test at the above test and look at the firebird for open attachments. Can it be a pooling problem?

But the naming of the database for the test contains the server type.

I have sometimes similar problems on customers machine. When i try a gbak, i get the same messsage, if i than make the gbak with the service, it works. Strange...

cincuranet commented 1 year ago

The tests are running automatically and i don't know, if tests are running in parallel.

Each test is run sequentially with respect to other tests.

Can it be a pooling problem?

Very unlikely.

AlexPeshkoff commented 1 year ago

On 6/27/23 20:08, Jiri Cincura ↹ wrote:

That looks like the DB is created/opened using server and later accessed by embedded.

You can also run in classic or superclassic server mode. That makes it possible to access DB from server and embedded simutaneously.

BFuerchau commented 12 months ago

Thanky for this hint. Some tests with embedded works well, but i get the message 40) Error : FirebirdSql.Data.FirebirdClient.Tests.FbBlobTests(Default,False,Required).ReaderGetBytes FirebirdSql.Data.FirebirdClient.FbException : Database is probably already opened by another engine instance in another Windows session furthermore.

But all tests with my extensions adjustments runs fine: Test Run Summary Overall result: Failed Test Count: 2210, Passed: 1978, Failed: **192**, Warnings: 0, Inconclusive: 22, Skipped: 18 Failed Tests - Failures: 8, Errors: 184, Invalid: 0 Skipped Tests - Ignored: 4, Explicit: 14, Other: 0 Start time: 2023-06-30 16:09:21Z End time: 2023-06-30 16:34:14Z Duration: 1492.300 seconds

The failed are all embedded tests and some service tests, because i have also installed 2.5 and 3.0. I have stopped these sevices, but it makes no difference.

fdcastel commented 11 months ago

@cincuranet How do you debug the tests?

I'm having the same problem reported by @BFuerchau: The Embedded version of tests runs fine via Tests.ps1 but fails in in Visual Studio 2022 with

  System.DllNotFoundException : Unable to load DLL 'fbembed' or one of its dependencies: The specified module could not be found. (0x8007007E)
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.

image

Where do I set what embedded version / DLL the tests should use?

BTW: I had some troubles running the tests in VS 2022. I made some suggestions to improve it here.

cincuranet commented 11 months ago

How do you debug the tests?

I'm attaching debugger to the NUnitLite process. Running, especially, embedded tests from Test Explorer is PIA.

BFuerchau commented 11 months ago

I have tested it native within visual studio and in case of test embedded, i change the config in the FbTestBase "BuildConnectionStringBuilder":

if (serverType == FbServerType.Embedded) { // Installation path of firebird builder.ClientLibrary = "D:\\Downloads\\Firebird\\Firebird-4.0.2.2816-0-x64\\fbclient.dll"; } Normally the embedded.dll is a copy of fbclient.dll which must reside in the firebird directory. And than it works.

BFuerchau commented 11 months ago

I debug the tests only concerning my changes within GdsStatement and FbDataReader. This works all fine. I didn't know anything to the NUnit how to run only specific tests. The most embedded tests run, but some seams not to close the embedded Database from the test before. I found the embedded databases in the %WINDIR%\System32 and i didn't find a property in the config to set a default path for new databases. On customer systems we uses allways the default windows installer so we didn't have problems with parallel installations. May be it's depending on my installation. In my environment i have parallel installed FB 2.5, FB 3.0 and now additional FB 4.0 with a copy install. In the config, all databases uses different ports and different Services are also registered. I didn't create the FIREBIRD-Environmentvariable, because all servers read than the same config and uses the same port.

During tests i shutdown FB 2.5 and FB 3.0, because tests concerning services fails because the wrong server would be called. I have changed the config to classic server, but this makes also no difference for embedded tests.

fdcastel commented 11 months ago

I have tested it native within visual studio and in case of test embedded, i change the config in the FbTestBase "BuildConnectionStringBuilder":

if (serverType == FbServerType.Embedded) { // Installation path of firebird builder.ClientLibrary = "D:\\Downloads\\Firebird\\Firebird-4.0.2.2816-0-x64\\fbclient.dll"; }

Thanks @BFuerchau. I didn't understand this in your original message.

fdcastel commented 11 months ago

How do you debug the tests?

I'm attaching debugger to the NUnitLite process. Running, especially, embedded tests from Test Explorer is PIA.

Maybe it's just me. But attaching debugger to another process every time I wish to debug code is a bigger PIA.

BFuerchau commented 11 months ago

What do you mean with PIA?

fdcastel commented 11 months ago

What do you mean with PIA?

An annoying, tedious or repetitive task.

We love TLAs (three letter acronyms) 😅