Skip to content

Commit 47b84f6

Browse files
move end2end tests code to a single directory (#197)
* move end2end tests code to a single directory
1 parent d876e2e commit 47b84f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+44
-40
lines changed

.github/workflows/build.yml

+6
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ jobs:
6161
with:
6262
name: wasm-file
6363
path: dist/plugin.wasm
64+
6465
lint:
6566
name: Lint
6667
needs: [build-wasm]
@@ -92,6 +93,11 @@ jobs:
9293
steps:
9394
- uses: actions/checkout@v4
9495

96+
- name: Verify pushed generated tests code is synced
97+
run: |
98+
./end2end/scripts/generate_tests.sh
99+
git diff --quiet
100+
95101
- uses: actions/download-artifact@v4
96102
with:
97103
name: wasm-file

.github/workflows/legacy-tests.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ jobs:
7373
Get-ChildItem -Path examples -Recurse -Filter *.csproj |
7474
Where-Object { $_.FullName -like '*Legacy*' } |
7575
ForEach-Object { nuget restore $_.FullName }
76-
nuget restore ./EndToEndCommon/EndToEndCommon.csproj
77-
nuget restore ./EndToEndTestsLegacy/EndToEndTestsLegacy.csproj
78-
msbuild.exe ./EndToEndTestsLegacy/EndToEndTestsLegacy.csproj -p:Configuration=Release -p:FrameworkVersion=v4.7.2
76+
nuget restore ./end2end/EndToEndCommon/EndToEndCommon.csproj
77+
nuget restore ./end2end/EndToEndTestsLegacy/EndToEndTestsLegacy.csproj
78+
msbuild.exe ./end2end/EndToEndTestsLegacy/EndToEndTestsLegacy.csproj -p:Configuration=Release -p:FrameworkVersion=v4.7.2
7979
return $LASTEXITCODE
8080
}
8181
@@ -108,4 +108,4 @@ jobs:
108108
run: |
109109
$path = vswhere -latest -products * -requires Microsoft.VisualStudio.Workload.ManagedDesktop Microsoft.VisualStudio.Workload.Web -requiresAny -property installationPath
110110
$path = join-path $path 'Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe'
111-
& $path ./EndToEndTestsLegacy/bin/Release/net472/EndToEndTestsLegacy.dll
111+
& $path ./end2end/EndToEndTestsLegacy/bin/Release/net472/EndToEndTestsLegacy.dll

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ jobs:
4747
uses: hoverkraft-tech/[email protected]
4848

4949
- name: Run Tests
50-
run: ./scripts/run_end2end_tests.sh
50+
run: ./end2end/scripts/run_tests.sh

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ unit-tests:
1111
dotnet test SqlcGenCsharpTests
1212

1313
run-end2end-tests:
14-
./scripts/run_end2end_tests.sh
14+
./end2end/scripts/run_tests.sh
1515

1616
# process type plugin
1717
dotnet-build-process: protobuf-generate dotnet-format

MySqlConnectorTester.generated.cs

-1
This file was deleted.

docs/03_Usage.md

+4-5

docs/ExamplesDocGen/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ private static string ParseConfigNode(YamlNode node)
4747
return $"""
4848
## Engine `{item["engine"]}`: [{projectName}]({outputDirectory})
4949
50-
### [Schema]({item["schema"]}) | [Queries]({queryFiles}) | [End2End Test]({testProject}/{testClassName}.cs)
50+
### [Schema]({item["schema"]}) | [Queries]({queryFiles}) | [End2End Test](end2end/{testProject}/{testClassName}.cs)
5151
5252
### Config
5353
```yaml
File renamed without changes.
File renamed without changes.

EndToEndCommon/EndToEndCommon.csproj end2end/EndToEndCommon/EndToEndCommon.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<Content Include="../.env">
9+
<Content Include="../../.env">
1010
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
1111
</Content>
12-
<Content Include="../examples/config/sqlite/schema.sql">
12+
<Content Include="../../examples/config/sqlite/schema.sql">
1313
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
1414
<TargetPath>sqlite.schema.sql</TargetPath>
1515
</Content>
File renamed without changes.
File renamed without changes.

EndToEndScaffold/EndToEndScaffold.csproj end2end/EndToEndScaffold/EndToEndScaffold.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<ProjectReference Include="..\PluginOptions\PluginOptions.csproj" />
14+
<ProjectReference Include="..\..\PluginOptions\PluginOptions.csproj" />
1515
</ItemGroup>
1616

1717
</Project>
File renamed without changes.
File renamed without changes.

EndToEndTests/EndToEndTests.csproj end2end/EndToEndTests/EndToEndTests.csproj

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<Content Include="../.env">
10+
<Content Include="../../.env">
1111
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
1212
</Content>
13-
<Content Include="../examples/config/sqlite/schema.sql">
13+
<Content Include="../../examples/config/sqlite/schema.sql">
1414
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
1515
<TargetPath>sqlite.schema.sql</TargetPath>
1616
</Content>
@@ -26,11 +26,11 @@
2626

2727
<ItemGroup>
2828
<ProjectReference Include="..\EndToEndCommon\EndToEndCommon.csproj" />
29-
<ProjectReference Include="..\examples\MySqlConnectorDapperExample\MySqlConnectorDapperExample.csproj" />
30-
<ProjectReference Include="..\examples\MySqlConnectorExample\MySqlConnectorExample.csproj" />
31-
<ProjectReference Include="..\examples\NpgsqlDapperExample\NpgsqlDapperExample.csproj" />
32-
<ProjectReference Include="..\examples\NpgsqlExample\NpgsqlExample.csproj" />
33-
<ProjectReference Include="..\examples\SqliteDapperExample\SqliteDapperExample.csproj" />
34-
<ProjectReference Include="..\examples\SqliteExample\SqliteExample.csproj" />
29+
<ProjectReference Include="..\..\examples\MySqlConnectorDapperExample\MySqlConnectorDapperExample.csproj" />
30+
<ProjectReference Include="..\..\examples\MySqlConnectorExample\MySqlConnectorExample.csproj" />
31+
<ProjectReference Include="..\..\examples\NpgsqlDapperExample\NpgsqlDapperExample.csproj" />
32+
<ProjectReference Include="..\..\examples\NpgsqlExample\NpgsqlExample.csproj" />
33+
<ProjectReference Include="..\..\examples\SqliteDapperExample\SqliteDapperExample.csproj" />
34+
<ProjectReference Include="..\..\examples\SqliteExample\SqliteExample.csproj" />
3535
</ItemGroup>
3636
</Project>
File renamed without changes.
File renamed without changes.
File renamed without changes.

EndToEndTestsLegacy/EndToEndTestsLegacy.csproj end2end/EndToEndTestsLegacy/EndToEndTestsLegacy.csproj

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<Content Include="../.env">
9+
<Content Include="../../.env">
1010
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
1111
</Content>
12-
<Content Include="../examples/config/sqlite/schema.sql">
12+
<Content Include="../../examples/config/sqlite/schema.sql">
1313
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
1414
<TargetPath>sqlite.schema.sql</TargetPath>
1515
</Content>
@@ -25,12 +25,12 @@
2525

2626
<ItemGroup>
2727
<ProjectReference Include="..\EndToEndCommon\EndToEndCommon.csproj" />
28-
<ProjectReference Include="..\examples\MySqlConnectorDapperLegacyExample\MySqlConnectorDapperLegacyExample.csproj" />
29-
<ProjectReference Include="..\examples\MySqlConnectorLegacyExample\MySqlConnectorLegacyExample.csproj" />
30-
<ProjectReference Include="..\examples\NpgsqlDapperLegacyExample\NpgsqlDapperLegacyExample.csproj" />
31-
<ProjectReference Include="..\examples\NpgsqlLegacyExample\NpgsqlLegacyExample.csproj" />
32-
<ProjectReference Include="..\examples\SqliteDapperLegacyExample\SqliteDapperLegacyExample.csproj" />
33-
<ProjectReference Include="..\examples\SqliteLegacyExample\SqliteLegacyExample.csproj" />
28+
<ProjectReference Include="..\..\examples\MySqlConnectorDapperLegacyExample\MySqlConnectorDapperLegacyExample.csproj" />
29+
<ProjectReference Include="..\..\examples\MySqlConnectorLegacyExample\MySqlConnectorLegacyExample.csproj" />
30+
<ProjectReference Include="..\..\examples\NpgsqlDapperLegacyExample\NpgsqlDapperLegacyExample.csproj" />
31+
<ProjectReference Include="..\..\examples\NpgsqlLegacyExample\NpgsqlLegacyExample.csproj" />
32+
<ProjectReference Include="..\..\examples\SqliteDapperLegacyExample\SqliteDapperLegacyExample.csproj" />
33+
<ProjectReference Include="..\..\examples\SqliteLegacyExample\SqliteLegacyExample.csproj" />
3434
</ItemGroup>
3535

3636
</Project>
File renamed without changes.

scripts/generate_end2end_tests.sh end2end/scripts/generate_tests.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ generate() {
1616
export TEST_CLASS_NAME="$1"
1717
local TEST_FILENAME="${TEST_CLASS_NAME}.generated.cs"
1818
echo "generating EndToEndTests/$TEST_FILENAME..."
19-
dotnet run --project ./EndToEndScaffold/EndToEndScaffold.csproj > ./EndToEndTests/"$TEST_FILENAME"
19+
dotnet run --project ./end2end/EndToEndScaffold/EndToEndScaffold.csproj > ./end2end/EndToEndTests/"$TEST_FILENAME"
2020
}
2121

2222
generate_legacy() {
2323
export IS_LEGACY=true
2424
export TEST_CLASS_NAME="$1"
2525
local TEST_FILENAME="${TEST_CLASS_NAME}.generated.cs"
2626
echo "generating EndToEndTestsLegacy/$TEST_FILENAME..."
27-
dotnet run --project ./EndToEndScaffold/EndToEndScaffold.csproj > ./EndToEndTestsLegacy/"$TEST_FILENAME"
27+
dotnet run --project ./end2end/EndToEndScaffold/EndToEndScaffold.csproj > ./end2end/EndToEndTestsLegacy/"$TEST_FILENAME"
2828
}
2929

3030
for target in "${TARGETS[@]}"; do

scripts/run_end2end_tests.sh end2end/scripts/run_tests.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ set -ex
44

55
if [ "$GITHUB_ACTIONS" = "true" ]; then
66
echo "Running in Github Actions"
7-
dotnet test ./EndToEndTests/EndToEndTests.csproj
7+
dotnet test ./end2end/EndToEndTests/EndToEndTests.csproj
88
else
99
echo "Running in local"
1010

1111
destroy() { docker-compose down --volumes; }
1212
trap destroy EXIT
1313

1414
docker-compose up --detach --build --force-recreate --remove-orphans --wait
15-
dotnet test ./EndToEndTests/EndToEndTests.csproj
15+
dotnet test ./end2end/EndToEndTests/EndToEndTests.csproj
1616
fi

sqlc-gen-csharp.sln

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Extensions", "Extensions\Ex
99
EndProject
1010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Drivers", "Drivers\Drivers.csproj", "{6C698DAA-5151-4241-B07E-3435A717ABFB}"
1111
EndProject
12-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EndToEndTests", "EndToEndTests\EndToEndTests.csproj", "{3675F864-9CD2-49C0-9754-56E490F15DF0}"
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EndToEndTests", "end2end\EndToEndTests\EndToEndTests.csproj", "{3675F864-9CD2-49C0-9754-56E490F15DF0}"
1313
EndProject
1414
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WasmRunner", "WasmRunner\WasmRunner.csproj", "{D3095033-1C96-42D9-AE44-3D4F1B24CB51}"
1515
EndProject
@@ -21,7 +21,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeGenerator", "CodeGenera
2121
EndProject
2222
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginOptions", "PluginOptions\PluginOptions.csproj", "{ABD93C33-BEBE-4DE9-9ABF-430DAC1A938C}"
2323
EndProject
24-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EndToEndTestsLegacy", "EndToEndTestsLegacy\EndToEndTestsLegacy.csproj", "{7409C5C4-61B4-4219-930B-9FC9CD5C91A8}"
24+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EndToEndTestsLegacy", "end2end\EndToEndTestsLegacy\EndToEndTestsLegacy.csproj", "{7409C5C4-61B4-4219-930B-9FC9CD5C91A8}"
2525
EndProject
2626
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{9404C766-3491-4959-A575-D6015FFB7AE6}"
2727
EndProject
@@ -51,13 +51,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqliteExample", "examples\S
5151
EndProject
5252
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqlcGenCsharpTests", "SqlcGenCsharpTests\SqlcGenCsharpTests.csproj", "{9FD3C47C-88A5-4C4A-A807-1E36114CBB38}"
5353
EndProject
54-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EndToEndCommon", "EndToEndCommon\EndToEndCommon.csproj", "{FE5AA465-DC0E-4B14-9BD3-16B47813FB97}"
54+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EndToEndCommon", "end2end\EndToEndCommon\EndToEndCommon.csproj", "{FE5AA465-DC0E-4B14-9BD3-16B47813FB97}"
5555
EndProject
5656
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{4688A74C-E49F-4AF2-9443-C490D7956E0D}"
5757
EndProject
5858
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExampleDocGen", "docs\ExamplesDocGen\ExampleDocGen.csproj", "{48A7802E-3D90-4F19-B14A-9662CDEA86E3}"
5959
EndProject
60-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EndToEndScaffold", "EndToEndScaffold\EndToEndScaffold.csproj", "{2A101C54-4F0C-41AC-86B2-FFF6DFBFD0C0}"
60+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EndToEndScaffold", "end2end\EndToEndScaffold\EndToEndScaffold.csproj", "{2A101C54-4F0C-41AC-86B2-FFF6DFBFD0C0}"
6161
EndProject
6262
Global
6363
GlobalSection(SolutionConfigurationPlatforms) = preSolution

0 commit comments

Comments
 (0)