mirror of
				https://github.com/juanfont/headscale.git
				synced 2025-10-31 08:01:34 +01:00 
			
		
		
		
	Improve generated integration tests
- Save logs from control(headscale) on every run to tmp - Upgrade nix-actions - Cancel builds if new commit is pushed - Fix a sorting bug in user command test Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
		
							parent
							
								
									640bb94119
								
							
						
					
					
						commit
						727d95b477
					
				
							
								
								
									
										2
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							| @ -35,7 +35,7 @@ jobs: | |||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
|         run: nix build |         run: nix build | ||||||
| 
 | 
 | ||||||
|       - uses: actions/upload-artifact@v2 |       - uses: actions/upload-artifact@v3 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
|         with: |         with: | ||||||
|           name: headscale-linux |           name: headscale-linux | ||||||
|  | |||||||
| @ -6,6 +6,10 @@ name: Integration Test v2 - TestAuthKeyLogoutAndRelogin | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,6 +42,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -45,3 +50,9 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestAuthKeyLogoutAndRelogin$" |                   -run "^TestAuthKeyLogoutAndRelogin$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
|  | |||||||
| @ -6,6 +6,10 @@ name: Integration Test v2 - TestAuthWebFlowAuthenticationPingAll | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,6 +42,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -45,3 +50,9 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestAuthWebFlowAuthenticationPingAll$" |                   -run "^TestAuthWebFlowAuthenticationPingAll$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
|  | |||||||
| @ -6,6 +6,10 @@ name: Integration Test v2 - TestAuthWebFlowLogoutAndRelogin | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,6 +42,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -45,3 +50,9 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestAuthWebFlowLogoutAndRelogin$" |                   -run "^TestAuthWebFlowLogoutAndRelogin$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
|  | |||||||
| @ -6,6 +6,10 @@ name: Integration Test v2 - TestCreateTailscale | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,6 +42,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -45,3 +50,9 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestCreateTailscale$" |                   -run "^TestCreateTailscale$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
|  | |||||||
| @ -6,6 +6,10 @@ name: Integration Test v2 - TestEnablingRoutes | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,6 +42,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -45,3 +50,9 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestEnablingRoutes$" |                   -run "^TestEnablingRoutes$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
|  | |||||||
| @ -6,6 +6,10 @@ name: Integration Test v2 - TestHeadscale | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,6 +42,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -45,3 +50,9 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestHeadscale$" |                   -run "^TestHeadscale$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
|  | |||||||
| @ -6,6 +6,10 @@ name: Integration Test v2 - TestOIDCAuthenticationPingAll | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,6 +42,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -45,3 +50,9 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestOIDCAuthenticationPingAll$" |                   -run "^TestOIDCAuthenticationPingAll$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
|  | |||||||
| @ -6,6 +6,10 @@ name: Integration Test v2 - TestOIDCExpireNodes | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,6 +42,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -45,3 +50,9 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestOIDCExpireNodes$" |                   -run "^TestOIDCExpireNodes$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
|  | |||||||
| @ -6,6 +6,10 @@ name: Integration Test v2 - TestPingAllByHostname | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,6 +42,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -45,3 +50,9 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestPingAllByHostname$" |                   -run "^TestPingAllByHostname$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
|  | |||||||
| @ -6,6 +6,10 @@ name: Integration Test v2 - TestPingAllByIP | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,6 +42,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -45,3 +50,9 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestPingAllByIP$" |                   -run "^TestPingAllByIP$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
|  | |||||||
| @ -6,6 +6,10 @@ name: Integration Test v2 - TestPreAuthKeyCommand | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,6 +42,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -45,3 +50,9 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestPreAuthKeyCommand$" |                   -run "^TestPreAuthKeyCommand$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
|  | |||||||
| @ -6,6 +6,10 @@ name: Integration Test v2 - TestPreAuthKeyCommandReusableEphemeral | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,6 +42,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -45,3 +50,9 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestPreAuthKeyCommandReusableEphemeral$" |                   -run "^TestPreAuthKeyCommandReusableEphemeral$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
|  | |||||||
| @ -6,6 +6,10 @@ name: Integration Test v2 - TestPreAuthKeyCommandWithoutExpiry | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,6 +42,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -45,3 +50,9 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestPreAuthKeyCommandWithoutExpiry$" |                   -run "^TestPreAuthKeyCommandWithoutExpiry$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
|  | |||||||
| @ -6,6 +6,10 @@ name: Integration Test v2 - TestResolveMagicDNS | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,6 +42,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -45,3 +50,9 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestResolveMagicDNS$" |                   -run "^TestResolveMagicDNS$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
|  | |||||||
| @ -6,6 +6,10 @@ name: Integration Test v2 - TestSSHIsBlockedInACL | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,6 +42,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -45,3 +50,9 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestSSHIsBlockedInACL$" |                   -run "^TestSSHIsBlockedInACL$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
|  | |||||||
| @ -2,10 +2,14 @@ | |||||||
| # DO NOT EDIT, generated with cmd/gh-action-integration-generator/main.go | # DO NOT EDIT, generated with cmd/gh-action-integration-generator/main.go | ||||||
| # To regenerate, run "go generate" in cmd/gh-action-integration-generator/ | # To regenerate, run "go generate" in cmd/gh-action-integration-generator/ | ||||||
| 
 | 
 | ||||||
| name: Integration Test v2 - TestSSNamespaceOnlyIsolation | name: Integration Test v2 - TestSSHMultipleUsersAllToAll | ||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,10 +42,17 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
|                   -failfast \ |                   -failfast \ | ||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestSSNamespaceOnlyIsolation$" |                   -run "^TestSSHMultipleUsersAllToAll$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
| @ -6,6 +6,10 @@ name: Integration Test v2 - TestSSHNoSSHConfigured | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,6 +42,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -45,3 +50,9 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestSSHNoSSHConfigured$" |                   -run "^TestSSHNoSSHConfigured$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
|  | |||||||
| @ -2,10 +2,14 @@ | |||||||
| # DO NOT EDIT, generated with cmd/gh-action-integration-generator/main.go | # DO NOT EDIT, generated with cmd/gh-action-integration-generator/main.go | ||||||
| # To regenerate, run "go generate" in cmd/gh-action-integration-generator/ | # To regenerate, run "go generate" in cmd/gh-action-integration-generator/ | ||||||
| 
 | 
 | ||||||
| name: Integration Test v2 - TestSSHMultipleNamespacesAllToAll | name: Integration Test v2 - TestSSHOneUserAllToAll | ||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,10 +42,17 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
|                   -failfast \ |                   -failfast \ | ||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestSSHMultipleNamespacesAllToAll$" |                   -run "^TestSSHOneUserAllToAll$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
| @ -2,10 +2,14 @@ | |||||||
| # DO NOT EDIT, generated with cmd/gh-action-integration-generator/main.go | # DO NOT EDIT, generated with cmd/gh-action-integration-generator/main.go | ||||||
| # To regenerate, run "go generate" in cmd/gh-action-integration-generator/ | # To regenerate, run "go generate" in cmd/gh-action-integration-generator/ | ||||||
| 
 | 
 | ||||||
| name: Integration Test v2 - TestSSHOneNamespaceAllToAll | name: Integration Test v2 - TestSSUserOnlyIsolation | ||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,10 +42,17 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
|                   -failfast \ |                   -failfast \ | ||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestSSHOneNamespaceAllToAll$" |                   -run "^TestSSUserOnlyIsolation$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
| @ -6,6 +6,10 @@ name: Integration Test v2 - TestTaildrop | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,6 +42,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -45,3 +50,9 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestTaildrop$" |                   -run "^TestTaildrop$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
|  | |||||||
| @ -6,6 +6,10 @@ name: Integration Test v2 - TestTailscaleNodesJoiningHeadcale | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,6 +42,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -45,3 +50,9 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestTailscaleNodesJoiningHeadcale$" |                   -run "^TestTailscaleNodesJoiningHeadcale$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
|  | |||||||
| @ -2,10 +2,14 @@ | |||||||
| # DO NOT EDIT, generated with cmd/gh-action-integration-generator/main.go | # DO NOT EDIT, generated with cmd/gh-action-integration-generator/main.go | ||||||
| # To regenerate, run "go generate" in cmd/gh-action-integration-generator/ | # To regenerate, run "go generate" in cmd/gh-action-integration-generator/ | ||||||
| 
 | 
 | ||||||
| name: Integration Test v2 - TestNamespaceCommand | name: Integration Test v2 - TestUserCommand | ||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -26,8 +30,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: ${{ env.ACT }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -38,10 +42,17 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
|                   -failfast \ |                   -failfast \ | ||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^TestNamespaceCommand$" |                   -run "^TestUserCommand$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -27,6 +27,7 @@ derp.yaml | |||||||
| .idea | .idea | ||||||
| 
 | 
 | ||||||
| test_output/ | test_output/ | ||||||
|  | control_logs/ | ||||||
| 
 | 
 | ||||||
| # Nix build output | # Nix build output | ||||||
| result | result | ||||||
|  | |||||||
| @ -20,6 +20,10 @@ name: Integration Test v2 - {{.Name}} | |||||||
| 
 | 
 | ||||||
| on: [pull_request] | on: [pull_request] | ||||||
| 
 | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: {{ "${{ github.workflow }}-$${{ github.head_ref || github.run_id }}" }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   test: |   test: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| @ -40,8 +44,8 @@ jobs: | |||||||
|             integration_test/ |             integration_test/ | ||||||
|             config-example.yaml |             config-example.yaml | ||||||
| 
 | 
 | ||||||
|       - uses: cachix/install-nix-action@v16 |       - uses: cachix/install-nix-action@v18 | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: {{ "${{ env.ACT }}" }} || steps.changed-files.outputs.any_changed == 'true' | ||||||
| 
 | 
 | ||||||
|       - name: Run general integration tests |       - name: Run general integration tests | ||||||
|         if: steps.changed-files.outputs.any_changed == 'true' |         if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| @ -52,6 +56,7 @@ jobs: | |||||||
|               --name headscale-test-suite \ |               --name headscale-test-suite \ | ||||||
|               --volume $PWD:$PWD -w $PWD/integration \ |               --volume $PWD:$PWD -w $PWD/integration \ | ||||||
|               --volume /var/run/docker.sock:/var/run/docker.sock \ |               --volume /var/run/docker.sock:/var/run/docker.sock \ | ||||||
|  |               --volume $PWD/control_logs:/tmp/control \ | ||||||
|               golang:1 \ |               golang:1 \ | ||||||
|                 go test ./... \ |                 go test ./... \ | ||||||
|                   -tags ts2019 \ |                   -tags ts2019 \ | ||||||
| @ -59,6 +64,12 @@ jobs: | |||||||
|                   -timeout 120m \ |                   -timeout 120m \ | ||||||
|                   -parallel 1 \ |                   -parallel 1 \ | ||||||
|                   -run "^{{.Name}}$" |                   -run "^{{.Name}}$" | ||||||
|  | 
 | ||||||
|  |       - uses: actions/upload-artifact@v3 | ||||||
|  |         if: always() && steps.changed-files.outputs.any_changed == 'true' | ||||||
|  |         with: | ||||||
|  |           name: logs | ||||||
|  |           path: "control_logs/*.log" | ||||||
| `)) | `)) | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										46
									
								
								flake.nix
									
									
									
									
									
								
							
							
						
						
									
										46
									
								
								flake.nix
									
									
									
									
									
								
							| @ -6,36 +6,39 @@ | |||||||
|     flake-utils.url = "github:numtide/flake-utils"; |     flake-utils.url = "github:numtide/flake-utils"; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   outputs = { |   outputs = | ||||||
|     self, |     { self | ||||||
|     nixpkgs, |     , nixpkgs | ||||||
|     flake-utils, |     , flake-utils | ||||||
|     ... |     , ... | ||||||
|   }: let |     }: | ||||||
|  |     let | ||||||
|       headscaleVersion = |       headscaleVersion = | ||||||
|         if (self ? shortRev) |         if (self ? shortRev) | ||||||
|         then self.shortRev |         then self.shortRev | ||||||
|         else "dev"; |         else "dev"; | ||||||
|     in |     in | ||||||
|     { |     { | ||||||
|       overlay = _: prev: let |       overlay = _: prev: | ||||||
|  |         let | ||||||
|           pkgs = nixpkgs.legacyPackages.${prev.system}; |           pkgs = nixpkgs.legacyPackages.${prev.system}; | ||||||
|       in rec { |         in | ||||||
|  |         rec { | ||||||
|           headscale = pkgs.buildGo119Module rec { |           headscale = pkgs.buildGo119Module rec { | ||||||
|             pname = "headscale"; |             pname = "headscale"; | ||||||
|             version = headscaleVersion; |             version = headscaleVersion; | ||||||
|             src = pkgs.lib.cleanSource self; |             src = pkgs.lib.cleanSource self; | ||||||
| 
 | 
 | ||||||
|           tags = ["ts2019"]; |             tags = [ "ts2019" ]; | ||||||
| 
 | 
 | ||||||
|             # Only run unit tests when testing a build |             # Only run unit tests when testing a build | ||||||
|           checkFlags = ["-short"]; |             checkFlags = [ "-short" ]; | ||||||
| 
 | 
 | ||||||
|             # When updating go.mod or go.sum, a new sha will need to be calculated, |             # When updating go.mod or go.sum, a new sha will need to be calculated, | ||||||
|             # update this if you have a mismatch after doing a change to thos files. |             # update this if you have a mismatch after doing a change to thos files. | ||||||
|             vendorSha256 = "sha256-8p5NFxXKaZPsW4B6NMzfi0pqfVroIahSgA0fukvB3JI="; |             vendorSha256 = "sha256-8p5NFxXKaZPsW4B6NMzfi0pqfVroIahSgA0fukvB3JI="; | ||||||
| 
 | 
 | ||||||
|           ldflags = ["-s" "-w" "-X github.com/juanfont/headscale/cmd/headscale/cli.Version=v${version}"]; |             ldflags = [ "-s" "-w" "-X github.com/juanfont/headscale/cmd/headscale/cli.Version=v${version}" ]; | ||||||
|           }; |           }; | ||||||
| 
 | 
 | ||||||
|           golines = pkgs.buildGoModule rec { |           golines = pkgs.buildGoModule rec { | ||||||
| @ -51,7 +54,7 @@ | |||||||
| 
 | 
 | ||||||
|             vendorSha256 = "sha256-rxYuzn4ezAxaeDhxd8qdOzt+CKYIh03A9zKNdzILq18="; |             vendorSha256 = "sha256-rxYuzn4ezAxaeDhxd8qdOzt+CKYIh03A9zKNdzILq18="; | ||||||
| 
 | 
 | ||||||
|           nativeBuildInputs = [pkgs.installShellFiles]; |             nativeBuildInputs = [ pkgs.installShellFiles ]; | ||||||
|           }; |           }; | ||||||
| 
 | 
 | ||||||
|           golangci-lint = prev.golangci-lint.override { |           golangci-lint = prev.golangci-lint.override { | ||||||
| @ -73,19 +76,20 @@ | |||||||
| 
 | 
 | ||||||
|             vendorSha256 = "sha256-dGdnDuRbwg8fU7uB5GaHEWa/zI3w06onqjturvooJQA="; |             vendorSha256 = "sha256-dGdnDuRbwg8fU7uB5GaHEWa/zI3w06onqjturvooJQA="; | ||||||
| 
 | 
 | ||||||
|           nativeBuildInputs = [pkgs.installShellFiles]; |             nativeBuildInputs = [ pkgs.installShellFiles ]; | ||||||
| 
 | 
 | ||||||
|           subPackages = ["protoc-gen-grpc-gateway" "protoc-gen-openapiv2"]; |             subPackages = [ "protoc-gen-grpc-gateway" "protoc-gen-openapiv2" ]; | ||||||
|           }; |           }; | ||||||
|         }; |         }; | ||||||
|     } |     } | ||||||
|     // flake-utils.lib.eachDefaultSystem |     // flake-utils.lib.eachDefaultSystem | ||||||
|     (system: let |       (system: | ||||||
|  |       let | ||||||
|         pkgs = import nixpkgs { |         pkgs = import nixpkgs { | ||||||
|         overlays = [self.overlay]; |           overlays = [ self.overlay ]; | ||||||
|           inherit system; |           inherit system; | ||||||
|         }; |         }; | ||||||
|       buildDeps = with pkgs; [git go_1_19 gnumake]; |         buildDeps = with pkgs; [ git go_1_19 gnumake ]; | ||||||
|         devDeps = with pkgs; |         devDeps = with pkgs; | ||||||
|           buildDeps |           buildDeps | ||||||
|           ++ [ |           ++ [ | ||||||
| @ -93,6 +97,7 @@ | |||||||
|             golines |             golines | ||||||
|             nodePackages.prettier |             nodePackages.prettier | ||||||
|             goreleaser |             goreleaser | ||||||
|  |             gotestsum | ||||||
| 
 | 
 | ||||||
|             # Protobuf dependencies |             # Protobuf dependencies | ||||||
|             protobuf |             protobuf | ||||||
| @ -112,10 +117,11 @@ | |||||||
|         headscale-docker = pkgs.dockerTools.buildLayeredImage { |         headscale-docker = pkgs.dockerTools.buildLayeredImage { | ||||||
|           name = "headscale"; |           name = "headscale"; | ||||||
|           tag = headscaleVersion; |           tag = headscaleVersion; | ||||||
|         contents = [pkgs.headscale]; |           contents = [ pkgs.headscale ]; | ||||||
|         config.Entrypoint = [(pkgs.headscale + "/bin/headscale")]; |           config.Entrypoint = [ (pkgs.headscale + "/bin/headscale") ]; | ||||||
|         }; |         }; | ||||||
|     in rec { |       in | ||||||
|  |       rec { | ||||||
|         # `nix develop` |         # `nix develop` | ||||||
|         devShell = pkgs.mkShell { |         devShell = pkgs.mkShell { | ||||||
|           buildInputs = devDeps; |           buildInputs = devDeps; | ||||||
|  | |||||||
| @ -99,7 +99,7 @@ func TestUserCommand(t *testing.T) { | |||||||
| 
 | 
 | ||||||
| 	assert.Equal( | 	assert.Equal( | ||||||
| 		t, | 		t, | ||||||
| 		[]string{"user1", "newname"}, | 		[]string{"newname", "user1"}, | ||||||
| 		result, | 		result, | ||||||
| 	) | 	) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -6,6 +6,7 @@ import ( | |||||||
| 
 | 
 | ||||||
| type ControlServer interface { | type ControlServer interface { | ||||||
| 	Shutdown() error | 	Shutdown() error | ||||||
|  | 	SaveLog(string) error | ||||||
| 	Execute(command []string) (string, error) | 	Execute(command []string) (string, error) | ||||||
| 	GetHealthEndpoint() string | 	GetHealthEndpoint() string | ||||||
| 	GetEndpoint() string | 	GetEndpoint() string | ||||||
|  | |||||||
							
								
								
									
										68
									
								
								integration/dockertestutil/logs.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								integration/dockertestutil/logs.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,68 @@ | |||||||
|  | package dockertestutil | ||||||
|  | 
 | ||||||
|  | import ( | ||||||
|  | 	"bytes" | ||||||
|  | 	"context" | ||||||
|  | 	"log" | ||||||
|  | 	"os" | ||||||
|  | 	"path" | ||||||
|  | 
 | ||||||
|  | 	"github.com/ory/dockertest/v3" | ||||||
|  | 	"github.com/ory/dockertest/v3/docker" | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | const filePerm = 0o644 | ||||||
|  | 
 | ||||||
|  | func SaveLog( | ||||||
|  | 	pool *dockertest.Pool, | ||||||
|  | 	resource *dockertest.Resource, | ||||||
|  | 	basePath string, | ||||||
|  | ) error { | ||||||
|  | 	err := os.MkdirAll(basePath, os.ModePerm) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	var stdout bytes.Buffer | ||||||
|  | 	var stderr bytes.Buffer | ||||||
|  | 
 | ||||||
|  | 	err = pool.Client.Logs( | ||||||
|  | 		docker.LogsOptions{ | ||||||
|  | 			Context:      context.TODO(), | ||||||
|  | 			Container:    resource.Container.ID, | ||||||
|  | 			OutputStream: &stdout, | ||||||
|  | 			ErrorStream:  &stderr, | ||||||
|  | 			Tail:         "all", | ||||||
|  | 			RawTerminal:  false, | ||||||
|  | 			Stdout:       true, | ||||||
|  | 			Stderr:       true, | ||||||
|  | 			Follow:       false, | ||||||
|  | 			Timestamps:   false, | ||||||
|  | 		}, | ||||||
|  | 	) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	log.Printf("Saving logs for %s to %s\n", resource.Container.Name, basePath) | ||||||
|  | 
 | ||||||
|  | 	err = os.WriteFile( | ||||||
|  | 		path.Join(basePath, resource.Container.Name+".stdout.log"), | ||||||
|  | 		stdout.Bytes(), | ||||||
|  | 		filePerm, | ||||||
|  | 	) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	err = os.WriteFile( | ||||||
|  | 		path.Join(basePath, resource.Container.Name+".stderr.log"), | ||||||
|  | 		stderr.Bytes(), | ||||||
|  | 		filePerm, | ||||||
|  | 	) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
| @ -248,6 +248,10 @@ func (t *HeadscaleInContainer) Shutdown() error { | |||||||
| 	return t.pool.Purge(t.container) | 	return t.pool.Purge(t.container) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func (t *HeadscaleInContainer) SaveLog(path string) error { | ||||||
|  | 	return dockertestutil.SaveLog(t.pool, t.container, path) | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func (t *HeadscaleInContainer) Execute( | func (t *HeadscaleInContainer) Execute( | ||||||
| 	command []string, | 	command []string, | ||||||
| ) (string, error) { | ) (string, error) { | ||||||
|  | |||||||
| @ -126,7 +126,15 @@ func NewScenario() (*Scenario, error) { | |||||||
| 
 | 
 | ||||||
| func (s *Scenario) Shutdown() error { | func (s *Scenario) Shutdown() error { | ||||||
| 	s.controlServers.Range(func(_ string, control ControlServer) bool { | 	s.controlServers.Range(func(_ string, control ControlServer) bool { | ||||||
| 		err := control.Shutdown() | 		err := control.SaveLog("/tmp/control") | ||||||
|  | 		if err != nil { | ||||||
|  | 			log.Printf( | ||||||
|  | 				"Failed to save log from control: %s", | ||||||
|  | 				fmt.Errorf("failed to save log from control: %w", err), | ||||||
|  | 			) | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		err = control.Shutdown() | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			log.Printf( | 			log.Printf( | ||||||
| 				"Failed to shut down control: %s", | 				"Failed to shut down control: %s", | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user