diff options
| author | Clément Michaud <clement.michaud34@gmail.com> | 2020-03-03 08:18:25 +0100 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-03 18:18:25 +1100 | 
| commit | faf43de14f7e8f9d68455d024e34b2ec2886ea41 (patch) | |
| tree | ed3ffb7e3f042dc245aa210a9bf9ff452dd39af7 /cmd/authelia-suites | |
| parent | 0c43740a4eeba477794b9805dc141047196d6cf2 (diff) | |
[FEATURE] Add TLS support. (#677)
* [FEATURE] Add TLS support.
Fixes #368.
* [FEATURE] Introduce OnError hook in suites.
This hook allows to perform actions following an erroneous suite
like displaying the logs of Authelia.
* Display Authelia logs of Standalone suite when tests fail.
* Fix Standalone suite.
* Apply suggestions from code review
* Rename ssl_key and ssl_cert into tls_key and tls_cert.
Diffstat (limited to 'cmd/authelia-suites')
| -rw-r--r-- | cmd/authelia-suites/main.go | 23 | 
1 files changed, 22 insertions, 1 deletions
diff --git a/cmd/authelia-suites/main.go b/cmd/authelia-suites/main.go index 2ac03c3a2..4a75aff42 100644 --- a/cmd/authelia-suites/main.go +++ b/cmd/authelia-suites/main.go @@ -38,6 +38,12 @@ func main() {  		Run:   setupTimeoutSuite,  	} +	errorCmd := &cobra.Command{ +		Use:   "error [suite]", +		Short: "Run the OnError callback when some tests fail", +		Run:   runErrorCallback, +	} +  	stopCmd := &cobra.Command{  		Use:   "teardown [suite]",  		Short: "Teardown the suite environment", @@ -46,8 +52,11 @@ func main() {  	rootCmd.AddCommand(startCmd)  	rootCmd.AddCommand(setupTimeoutCmd) +	rootCmd.AddCommand(errorCmd)  	rootCmd.AddCommand(stopCmd) -	rootCmd.Execute() +	if err := rootCmd.Execute(); err != nil { +		log.Fatal(err) +	}  }  func createRunningSuiteFile(suite string) error { @@ -120,6 +129,18 @@ func setupTimeoutSuite(cmd *cobra.Command, args []string) {  	}  } +func runErrorCallback(cmd *cobra.Command, args []string) { +	suiteName := args[0] +	s := suites.GlobalRegistry.Get(suiteName) + +	if s.OnError == nil { +		return +	} +	if err := s.OnError(); err != nil { +		log.Fatal(err) +	} +} +  func teardownSuite(cmd *cobra.Command, args []string) {  	if os.Getenv("SKIP_TEARDOWN") != "" {  		return  | 
