mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 12:18:16 +00:00 
			
		
		
		
	Merge pull request #102209 from odinuge/node-e2e-fix
Ignore first SIGINT in node-e2e tests
This commit is contained in:
		@@ -29,6 +29,7 @@ import (
 | 
				
			|||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
	"os/exec"
 | 
						"os/exec"
 | 
				
			||||||
 | 
						"os/signal"
 | 
				
			||||||
	"path/filepath"
 | 
						"path/filepath"
 | 
				
			||||||
	"regexp"
 | 
						"regexp"
 | 
				
			||||||
	"sort"
 | 
						"sort"
 | 
				
			||||||
@@ -200,6 +201,20 @@ func main() {
 | 
				
			|||||||
		klog.Fatalf("--test-suite must be one of default, cadvisor, or conformance")
 | 
							klog.Fatalf("--test-suite must be one of default, cadvisor, or conformance")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Listen for SIGINT and ignore the first one. In case SIGINT is sent to this
 | 
				
			||||||
 | 
						// process and all its children, we ignore it here, while our children ssh connections
 | 
				
			||||||
 | 
						// are stopped. This allows us to gather artifacts and print out test state before
 | 
				
			||||||
 | 
						// being killed.
 | 
				
			||||||
 | 
						c := make(chan os.Signal)
 | 
				
			||||||
 | 
						signal.Notify(c, os.Interrupt)
 | 
				
			||||||
 | 
						go func() {
 | 
				
			||||||
 | 
							<-c
 | 
				
			||||||
 | 
							fmt.Printf("Received SIGINT. Will exit on next SIGINT.\n")
 | 
				
			||||||
 | 
							<-c
 | 
				
			||||||
 | 
							fmt.Printf("Received another SIGINT. Will exit.\n")
 | 
				
			||||||
 | 
							os.Exit(1)
 | 
				
			||||||
 | 
						}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rand.Seed(time.Now().UnixNano())
 | 
						rand.Seed(time.Now().UnixNano())
 | 
				
			||||||
	if *buildOnly {
 | 
						if *buildOnly {
 | 
				
			||||||
		// Build the archive and exit
 | 
							// Build the archive and exit
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user