File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 77 <NoWarn >CA1303</NoWarn >
88 </PropertyGroup >
99 <ItemGroup >
10+ <PackageReference Include =" Cake.Docker" Version =" 1.0.0" />
1011 <PackageReference Include =" Cake.Frosting" Version =" 1.3.0" />
1112 </ItemGroup >
1213</Project >
Original file line number Diff line number Diff line change 1- return new CakeHost ( )
1+ using Cake . Docker ;
2+
3+ return new CakeHost ( )
24 . UseContext < BuildContext > ( )
35 . Run ( args ) ;
46
@@ -84,6 +86,29 @@ public override void Run(BuildContext context)
8486 context . Warning ( $ "=============Running { targetFramework . ToUpper ( ) } tests for { testProj . AssemblyName } =============") ;
8587 settings . Framework = targetFramework ;
8688
89+ if ( testProj . AssemblyName == "LocalStack.Client.Functional.Tests" )
90+ {
91+ context . Warning ( "Deleting running docker containers" ) ;
92+
93+ try
94+ {
95+ string psOutput = context . DockerPs ( new DockerContainerPsSettings ( ) { All = true , Quiet = true } ) ;
96+
97+ if ( ! string . IsNullOrEmpty ( psOutput ) )
98+ {
99+ context . Warning ( psOutput ) ;
100+
101+ string [ ] containers = psOutput . Split ( new [ ] { Environment . NewLine } , StringSplitOptions . None ) ;
102+ context . DockerRm ( containers ) ;
103+ }
104+ }
105+ catch
106+ {
107+ // ignored
108+ }
109+ }
110+
111+
87112 if ( context . IsRunningOnUnix ( ) && targetFramework == "net461" )
88113 {
89114 context . RunXUnitUsingMono ( targetFramework , $ "{ testProj . DirectoryPath } /bin/{ context . BuildConfiguration } /{ targetFramework } /{ testProj . AssemblyName } .dll") ;
You can’t perform that action at this time.
0 commit comments