Skip to content

Commit 7813cdb

Browse files
authored
test: run tests using SQLite (#18)
1 parent 86f728c commit 7813cdb

File tree

6 files changed

+47
-47
lines changed

6 files changed

+47
-47
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,10 @@ jobs:
77

88
runs-on: ubuntu-latest
99

10-
strategy:
11-
fail-fast: false
12-
matrix:
13-
include:
14-
- DB: SqlServer
15-
CONNECTION_STRING: "Server=localhost;User Id=sa;Password=P@ssw0rd;packet size=4096;"
16-
17-
name: ${{matrix.DB}}
18-
1910
env:
2011
IGNORE_NORMALISATION_GIT_HEAD_MOVE: 1
2112

2213
steps:
23-
- name: Set up SqlServer
24-
if: matrix.DB == 'SqlServer'
25-
run: |
26-
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=P@ssw0rd" -e "MSSQL_PID=Express" -p 1433:1433 -d --name sqlexpress mcr.microsoft.com/mssql/server:2019-latest;
27-
2814
- uses: actions/checkout@v3
2915
with:
3016
fetch-depth: 0
@@ -41,13 +27,10 @@ jobs:
4127
run: dotnet build src -m:1 --no-restore
4228

4329
- name: Configure
44-
run: |
45-
sudo apt-get install xmlstarlet -yy
46-
cp build-common/teamcity-hibernate.cfg.xml ./hibernate.cfg.xml
47-
xmlstarlet ed -L -N ns="urn:nhibernate-configuration-2.2" -u '//ns:property[@name="connection.connection_string"]' -v '${{matrix.CONNECTION_STRING}}' hibernate.cfg.xml
30+
run: cp build-common/teamcity-hibernate.cfg.xml ./hibernate.cfg.xml
4831

4932
- name: Test
50-
run: dotnet test src -f net6.0 --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage
33+
run: dotnet test src -f net6.0 --no-build --collect:"XPlat Code Coverage" --results-directory ./coverage
5134

5235
- name: Code Coverage Report
5336
uses: irongut/[email protected]
@@ -56,9 +39,6 @@ jobs:
5639
badge: true
5740
fail_below_min: true
5841
format: markdown
59-
hide_branch_rate: false
60-
hide_complexity: true
61-
indicators: true
6242
output: both
6343
thresholds: '60 80'
6444

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,5 @@ slave/
4949
master/
5050
indextemp/
5151
filehelperdest/
52+
nhibernate.db
53+
coverage/

build-common/teamcity-hibernate.cfg.xml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,33 @@
33
<bytecode-provider type="lcg"/>
44
<reflection-optimizer use="true"/>
55
<session-factory name="NHibernate.Test">
6+
<property name="dialect">NHibernate.Dialect.SQLiteDialect</property>
7+
<property name="connection.driver_class">NHibernate.Driver.SQLite20Driver</property>
8+
<!-- DateTimeFormatString allows to prevent storing the fact that written date was having kind UTC,
9+
which dodges the undesirable time conversion to local done on reads by System.Data.SQLite.
10+
See https://system.data.sqlite.org/index.html/tktview/44a0955ea344a777ffdbcc077831e1adc8b77a36
11+
and https://github.com/nhibernate/nhibernate-core/issues/1362 -->
12+
<property name="connection.connection_string">
13+
Data Source=nhibernate.db;
14+
DateTimeFormatString=yyyy-MM-dd HH:mm:ss.FFFFFFF;
15+
</property>
16+
617
<property name="connection.provider">NHibernate.Test.DebugConnectionProvider, NHibernate.Search.Tests</property>
7-
<property name="connection.isolation">ReadCommitted</property>
18+
<property name="connection.isolation">ReadCommitted</property> <!-- See System.Data.IsolationLevel for valid values -->
19+
20+
<property name="cache.provider_class">NHibernate.Cache.HashtableCacheProvider, NHibernate</property>
21+
<property name="cache.use_query_cache">true</property>
822

9-
<!-- This is the System.Data.dll provider for MSSQL Server -->
10-
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
11-
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
12-
<property name="connection.connection_string">Server=.\SQLExpress;initial catalog=nhibernate;Integrated Security=SSPI</property>
1323
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
1424
<property name="adonet.batch_size">10</property>
1525
<property name="prepare_sql">false</property>
16-
<property name="cache.provider_class">NHibernate.Cache.HashtableCacheProvider, NHibernate</property>
17-
<property name="cache.use_query_cache">true</property>
18-
26+
1927
<!-- the following part is not read by the test, they are here being a template-->
20-
<listener class='NHibernate.Search.Event.FullTextIndexEventListener, NHibernate.Search' type='post-insert'/>
21-
<listener class='NHibernate.Search.Event.FullTextIndexEventListener, NHibernate.Search' type='post-update'/>
22-
<listener class='NHibernate.Search.Event.FullTextIndexEventListener, NHibernate.Search' type='post-delete'/>
28+
<listener class="NHibernate.Search.Event.FullTextIndexEventListener, NHibernate.Search" type="post-insert"/>
29+
<listener class="NHibernate.Search.Event.FullTextIndexEventListener, NHibernate.Search" type="post-update"/>
30+
<listener class="NHibernate.Search.Event.FullTextIndexEventListener, NHibernate.Search" type="post-delete"/>
31+
<listener class="NHibernate.Search.Event.FullTextIndexCollectionEventListener, NHibernate.Search" type="post-collection-recreate"/>
32+
<listener class="NHibernate.Search.Event.FullTextIndexCollectionEventListener, NHibernate.Search" type="post-collection-remove"/>
33+
<listener class="NHibernate.Search.Event.FullTextIndexCollectionEventListener, NHibernate.Search" type="post-collection-update"/>
2334
</session-factory>
2435
</hibernate-configuration>

build.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
dotnet build src/NHibernate.Search.sln
2-
copy build-common/teamcity-hibernate.cfg.xml src/NHibernate.Search.Tests/hibernate.cfg.xml
3-
dotnet test src/NHibernate.Search.sln
1+
dotnet build src\NHibernate.Search.sln
2+
copy build-common\teamcity-hibernate.cfg.xml src\NHibernate.Search.Tests\hibernate.cfg.xml /y
3+
dotnet test src\NHibernate.Search.sln

src/NHibernate.Search.Tests/App.config

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,28 @@
1919
<bytecode-provider type="lcg"/>
2020
<reflection-optimizer use="true"/>
2121
<session-factory name="NHibernate.Test">
22+
<property name="dialect">NHibernate.Dialect.SQLiteDialect</property>
23+
<property name="connection.driver_class">NHibernate.Driver.SQLite20Driver</property>
24+
<!-- DateTimeFormatString allows to prevent storing the fact that written date was having kind UTC,
25+
which dodges the undesirable time conversion to local done on reads by System.Data.SQLite.
26+
See https://system.data.sqlite.org/index.html/tktview/44a0955ea344a777ffdbcc077831e1adc8b77a36
27+
and https://github.com/nhibernate/nhibernate-core/issues/1362 -->
28+
<property name="connection.connection_string">
29+
Data Source=nhibernate.db;
30+
DateTimeFormatString=yyyy-MM-dd HH:mm:ss.FFFFFFF;
31+
</property>
32+
2233
<property name="connection.provider">NHibernate.Test.DebugConnectionProvider, NHibernate.Search.Tests</property>
23-
<property name="connection.isolation">ReadCommitted</property>
34+
<property name="connection.isolation">ReadCommitted</property> <!-- See System.Data.IsolationLevel for valid values -->
35+
36+
<property name="cache.provider_class">NHibernate.Cache.HashtableCacheProvider, NHibernate</property>
37+
<property name="cache.use_query_cache">true</property>
2438

25-
<!-- This is the System.Data.dll provider for MSSQL Server -->
26-
<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
27-
<property name="connection.connection_string">Server=.\sqlexpress;initial catalog=nhsearch;Integrated Security=SSPI</property>
2839
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
2940
<property name="adonet.batch_size">10</property>
3041
<property name="prepare_sql">false</property>
31-
<property name="cache.provider_class">NHibernate.Cache.HashtableCacheProvider, NHibernate</property>
32-
<property name="cache.use_query_cache">true</property>
33-
34-
<!-- the following part is not read by the test, they are here being a template-->
42+
43+
<!-- the following part is not read by the test, they are here being a template-->
3544
<listener class="NHibernate.Search.Event.FullTextIndexEventListener, NHibernate.Search" type="post-insert"/>
3645
<listener class="NHibernate.Search.Event.FullTextIndexEventListener, NHibernate.Search" type="post-update"/>
3746
<listener class="NHibernate.Search.Event.FullTextIndexEventListener, NHibernate.Search" type="post-delete"/>

src/NHibernate.Search.Tests/NHibernate.Search.Tests.csproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
<PackageReference Include="NUnit" Version="3.13.3" />
2121
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
2222
<PackageReference Include="coverlet.collector" Version="3.1.2" PrivateAssets="All" />
23-
</ItemGroup>
24-
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
25-
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
23+
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.116" />
2624
</ItemGroup>
2725
</Project>

0 commit comments

Comments
 (0)