mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-04 16:34:52 +03:00
test(install): expect the installer to finish after a failed certificate
The Go regression still asserted that a failed SSL setup stops the install before the service is set up, the behaviour this branch no longer has.
This commit is contained in:
@@ -299,17 +299,19 @@ func TestScriptConfigReadFailureKeepsServiceSetup(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestInstallerSSLFailureStopsServiceSetup(t *testing.T) {
|
||||
func TestInstallerSSLFailureKeepsServiceSetup(t *testing.T) {
|
||||
dir, out, err := runScriptConfig(t, "install.sh", "/a/", true, "ssl_failure", 1, true)
|
||||
if err == nil {
|
||||
t.Fatalf("SSL failure should abort installation before service setup:\n%s", out)
|
||||
if err != nil {
|
||||
t.Fatalf("a failed certificate must not abort the install: %v\n%s", err, out)
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(dir, "ssl")); err != nil {
|
||||
t.Fatalf("SSL setup was not attempted: %v\n%s", err, out)
|
||||
}
|
||||
for _, name := range []string{"lifecycle", "restarts"} {
|
||||
if actual := readScriptState(t, dir, name); actual != "" {
|
||||
t.Errorf("failed SSL setup continued %s: %q", name, actual)
|
||||
for name, want := range map[string]string{
|
||||
"lifecycle": "fail2ban\nunit\n", "restarts": "daemon-reload\nenable x-ui\nrestart x-ui\n",
|
||||
} {
|
||||
if actual := readScriptState(t, dir, name); actual != want {
|
||||
t.Errorf("%s after a failed certificate = %q, want %q: the panel must still be installed and started", name, actual, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user