refactor: use nginx -s reload instead of systemd
- doc: add comment
This commit is contained in:
@@ -9,6 +9,8 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestOpenAndCopyDirectNativeJAR 验证正常流程:打开直接提供的 JAR 后元数据正确,
|
||||
// 且 CopyArtifact 复制出的内容与源文件完全一致。
|
||||
func TestOpenAndCopyDirectNativeJAR(t *testing.T) {
|
||||
jarPath := writeDirectNativeJAR(t, "glory-soft-yms.jar", []byte("backend classes"))
|
||||
jar, err := OpenDirectNativeJAR(jarPath)
|
||||
@@ -33,6 +35,8 @@ func TestOpenAndCopyDirectNativeJAR(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestOpenDirectNativeJARRejectsInvalidArchive 验证内容并非合法 ZIP 的 JAR 文件
|
||||
// 会被 OpenDirectNativeJAR 拒绝。
|
||||
func TestOpenDirectNativeJARRejectsInvalidArchive(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "glory-soft-yms.jar")
|
||||
if err := os.WriteFile(path, []byte("not a JAR"), 0o600); err != nil {
|
||||
@@ -43,6 +47,8 @@ func TestOpenDirectNativeJARRejectsInvalidArchive(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestCopyDirectNativeJARRejectsChangedSource 验证源 JAR 在 OpenDirectNativeJAR
|
||||
// 之后被替换时,CopyArtifact 会返回包含 "changed" 的错误。
|
||||
func TestCopyDirectNativeJARRejectsChangedSource(t *testing.T) {
|
||||
jarPath := writeDirectNativeJAR(t, "glory-soft-yms.jar", []byte("first"))
|
||||
jar, err := OpenDirectNativeJAR(jarPath)
|
||||
@@ -63,6 +69,8 @@ func TestCopyDirectNativeJARRejectsChangedSource(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// writeDirectNativeJAR 在临时目录创建名为 fileName 的 JAR,内含一个
|
||||
// BOOT-INF/classes/application.properties 条目,内容为 content,返回文件路径。
|
||||
func writeDirectNativeJAR(t *testing.T, fileName string, content []byte) string {
|
||||
t.Helper()
|
||||
jarPath := filepath.Join(t.TempDir(), fileName)
|
||||
|
||||
Reference in New Issue
Block a user