Skip to content

Commit ee1f78c

Browse files
Eliminate generation of config files multiple times in the integration test pipelines (#1910)
## Why make this change? - Closes #1909 - To include CLI as part of the integration testing, config file used for all the integration tests are generated by CLI and in turn, these generated config files are used by the tests. The config file generation is added as a post build event (in the CLI module) to enable generation of config files in the a) integration testing pipelines b) local (if developer wishes to try out the config files we've used during development/testing.) - At the moment, the config file generation gets triggered twice. Ensuring that the config file generation is executed only once will improve the time taken in the integration testing pipelines. ## What is this change? - The config file generation gets triggered when building the 1) CLI 2) CLI.Tests modules. - The build step in the pipeline is broken up as two 1. Build all the non-testing modules with `-p:generateConfigFileForDbType=<database_type>` 2. Build the test modules without any arguements. The presence of `-p:generateConfigFileForDbType` argument determines the execution of config generation script. So, when the test modules are built without this argument, the config file generation script does not execute. ## Choice of the executing config generation script in CLI vs CLI.Tests module: The PostBuildEvent for executing the config generator scripts after build could have been added either in `CLI` or `CLI.Tests` module. The module where this event is added determines where the `generateConfigFileForDbType` is used along with the `dotnet build` command. From the perspective of being able to execute the integration tests, there is no difference in adding it in CLI or CLI.Tests module. Adding it in CLI project has the additional advantages: 1) When a developer wishes to clone the repo and work with the config files we have used thus far for development/testing, being able to execute this post build event using the `-p:generateConfigFileForDbType` enables them to do this. Test module does not seem to be the right place for this. 2) Being able to validate new changes being worked on manually in local - For these, typically the test modules are not built. For example: When a change spans CLI + Engine modules, being able to generate the config file and validate that the introduced changes work fine is essential. One should be able to perform this manual validation just by building the modules where the changes are there without requiring building the test projects. ## How was this tested? - [x] Executing integration tests in the pipeline manually. Also, in the pipelines that have executed for this PR, it can be seen that the config generation executed only once in the integration testing pipelines. ## Sample Request(s) N/A
1 parent 0829d85 commit ee1f78c

File tree

5 files changed

+72
-9
lines changed

5 files changed

+72
-9
lines changed

.pipelines/cosmos-pipelines.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,18 @@ steps:
6060
displayName: Build
6161
inputs:
6262
command: build
63-
projects: '**/*.csproj'
63+
projects: |
64+
**/*.csproj
65+
!**/*Tests*.csproj
6466
arguments: '-p:generateConfigFileForDbType=cosmosdb_nosql --configuration $(buildConfiguration)' # Update this to match your need
6567

68+
- task: DotNetCoreCLI@2
69+
displayName: Build Test Projects
70+
inputs:
71+
command: build
72+
projects: '**/*Tests/*.csproj'
73+
arguments: '--configuration $(buildConfiguration)'
74+
6675
- bash: |
6776
echo "Waiting for CosmosDB Emulator to Start"
6877
until [ "$(curl -k -s --connect-timeout 5 -o /dev/null -w "%{http_code}" https://localhost:8081/_explorer/index.html)" == "200" ]; do

.pipelines/dwsql-pipelines.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,18 @@ jobs:
7979
displayName: Build
8080
inputs:
8181
command: build
82-
projects: '**/*.csproj'
82+
projects: |
83+
**/*.csproj
84+
!**/*Tests*.csproj
8385
arguments: '-p:generateConfigFileForDbType=dwsql --configuration $(buildConfiguration)' # Update this to match your need
8486

87+
- task: DotNetCoreCLI@2
88+
displayName: Build Test Projects
89+
inputs:
90+
command: build
91+
projects: '**/*Tests/*.csproj'
92+
arguments: '--configuration $(buildConfiguration)'
93+
8594
8695
displayName: 'Generate dab-config.DwSql.json'
8796
inputs:
@@ -194,9 +203,18 @@ jobs:
194203
displayName: Build
195204
inputs:
196205
command: build
197-
projects: '**/*.csproj'
206+
projects: |
207+
**/*.csproj
208+
!**/*Tests*.csproj
198209
arguments: '-p:generateConfigFileForDbType=DwSql --configuration $(buildConfiguration)' # Update this to match your need
199-
210+
211+
- task: DotNetCoreCLI@2
212+
displayName: Build Test Projects
213+
inputs:
214+
command: build
215+
projects: '**/*Tests/*.csproj'
216+
arguments: '--configuration $(buildConfiguration)'
217+
200218
201219
displayName: 'Generate dab-config.DwSql.json'
202220
inputs:

.pipelines/mssql-pipelines.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,18 @@ jobs:
6161
displayName: Build
6262
inputs:
6363
command: build
64-
projects: '**/*.csproj'
64+
projects: |
65+
**/*.csproj
66+
!**/*Tests*.csproj
6567
arguments: '-p:generateConfigFileForDbType=mssql --configuration $(buildConfiguration)' # Update this to match your need
6668

69+
- task: DotNetCoreCLI@2
70+
displayName: Build Test Projects
71+
inputs:
72+
command: build
73+
projects: '**/*Tests/*.csproj'
74+
arguments: '--configuration $(buildConfiguration)'
75+
6776
6877
displayName: 'Generate dab-config.MsSql.json'
6978
inputs:
@@ -176,9 +185,18 @@ jobs:
176185
displayName: Build
177186
inputs:
178187
command: build
179-
projects: '**/*.csproj'
188+
projects: |
189+
**/*.csproj
190+
!**/*Tests*.csproj
180191
arguments: '-p:generateConfigFileForDbType=MsSql --configuration $(buildConfiguration)' # Update this to match your need
181-
192+
193+
- task: DotNetCoreCLI@2
194+
displayName: Build Test Projects
195+
inputs:
196+
command: build
197+
projects: '**/*Tests/*.csproj'
198+
arguments: '--configuration $(buildConfiguration)'
199+
182200
183201
displayName: 'Generate dab-config.MsSql.json'
184202
inputs:

.pipelines/mysql-pipelines.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,18 @@ jobs:
6060
displayName: Build
6161
inputs:
6262
command: build
63-
projects: '**/*.csproj'
63+
projects: |
64+
**/*.csproj
65+
!**/*Tests*.csproj
6466
arguments: '-p:generateConfigFileForDbType=mysql --configuration $(buildConfiguration)' # Update this to match your need
6567

68+
- task: DotNetCoreCLI@2
69+
displayName: Build Test Projects
70+
inputs:
71+
command: build
72+
projects: '**/*Tests/*.csproj'
73+
arguments: '--configuration $(buildConfiguration)'
74+
6675
6776
displayName: 'Generate dab-config.MySql.json'
6877
inputs:

.pipelines/pg-pipelines.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,18 @@ jobs:
5555
displayName: Build
5656
inputs:
5757
command: build
58-
projects: '**/*.csproj'
58+
projects: |
59+
**/*.csproj
60+
!**/*Tests*.csproj
5961
arguments: '-p:generateConfigFileForDbType=postgresql --configuration $(buildConfiguration)' # Update this to match your need
6062

63+
- task: DotNetCoreCLI@2
64+
displayName: Build Test Projects
65+
inputs:
66+
command: build
67+
projects: '**/*Tests/*.csproj'
68+
arguments: '--configuration $(buildConfiguration)'
69+
6170
6271
displayName: 'Generate dab-config.PostgreSql.json'
6372
inputs:

0 commit comments

Comments
 (0)