完善阿里云权限与会话回归测试

This commit is contained in:
xuans committed 2026-09-16 04:09:07 +08:00
1 parent 50ece6093b
commit bbabc35cbf
25 files changed
+502 -250

No files matched your search

+2 -2
View File
@@ -378,8 +378,8 @@ export function useDashboard() {
renewal_urgent_threshold_days: 3,
renewal_max_retries: 3,
renewal_retry_interval_mins: 30,
propagation_timeout_secs: 900,
propagation_polling_interval_secs: 10,
propagation_timeout_secs: 300,
propagation_polling_interval_secs: 5,
},
dns: {
provider: "",
@@ -26,6 +26,8 @@ async function fill(state) {
test("已保存凭据不变可保存,输入新凭据必须重新验证", async (t) => {
const { state } = await setup(t, () => verifiedResponse());
assert.equal(state.dnsReadyToSave.value, true);
assert.equal(state.settingsForm.value.acme.propagation_timeout_secs, 300);
assert.equal(state.settingsForm.value.acme.propagation_polling_interval_secs, 5);
await fill(state);
assert.equal(state.dnsReadyToSave.value, false);
await state.testDNS();
@@ -54,14 +56,12 @@ test("管理设置拒绝过期验证令牌", async (t) => {
assert.equal(state.dnsReadyToSave.value, false);
});
test("管理设置变更托管区不能复用验证令牌", async (t) => {
test("管理设置变更阿里云凭据不能复用验证令牌", async (t) => {
const { state } = await setup(t, () => verifiedResponse());
await fill(state);
state.settingsForm.value.dns.credentials.managed_zones = "example.test";
state.settingsForm.value.dns.credentials.allowed_domains = "example.test";
await state.testDNS();
assert.equal(state.dnsReadyToSave.value, true);
state.settingsForm.value.dns.credentials.managed_zones = "other.test";
state.settingsForm.value.dns.credentials.access_key_id = "changed-key";
assert.equal(state.dnsReadyToSave.value, false);
assert.equal(state.settingsForm.value.dns.verification_token, "");
});
+22 -11
View File
@@ -473,12 +473,31 @@ const {
<div class="field-hint">剩余有效期低于自动续期阈值时触发续期;低于紧急阈值时按配置重试。</div>
</div>
<div class="form-grid">
<label class="field"><span>DNS 传播等待(秒)</span><input v-model.number="settingsForm.acme.propagation_timeout_secs" type="number" min="1" /></label>
<label class="field"><span>DNS 检测间隔(秒)</span><input v-model.number="settingsForm.acme.propagation_polling_interval_secs" type="number" min="1" /></label>
<label class="field">
<span>DNS 传播等待(秒)</span>
<input
v-model.number="settingsForm.acme.propagation_timeout_secs"
type="number"
min="1"
/>
</label>
<label class="field">
<span>DNS 检测间隔(秒)</span>
<input
v-model.number="settingsForm.acme.propagation_polling_interval_secs"
type="number"
min="1"
/>
</label>
</div>
<p class="field-hint">
阿里云 RAM 权限验证最多等待 6 秒:系统会创建、查询并清理临时 TXT
记录。以上 300 秒和 5 秒用于实际申请证书时的公网 DNS-01
传播等待与轮询。
</p>
<h3>DNS API 验证</h3>
<div class="settings-section-note">
<span>证书申请前会使用 DNS API 创建临时验证记录。</span>
<span>输入域名后,系统将使用当前阿里云账号立即创建、查询并清理临时 TXT 记录,以验证该域名的实际 DNS 操作权限。</span>
<span>凭据只会在本次在线测试请求中提交,系统仅保存加密引用。</span>
</div>
<div class="form-grid">
@@ -540,14 +559,6 @@ const {
/>
</label>
</div>
<p v-if="settingsForm.dns.scope_message" class="form-error">
{{ settingsForm.dns.scope_message }}
</p>
<div v-if="settingsForm.dns.user_scope" class="field-hint">
<p>已保存托管区:{{ settingsForm.dns.user_scope.managed_zones.join(",") }}</p>
<p>已保存允许域名:{{ settingsForm.dns.user_scope.allowed_domains.join(",") }}</p>
<p>修改范围需重新填写凭据并在线验证,不会自动扩大已有授权。</p>
</div>
<div v-if="selectedDNSProvider" class="dns-test-actions">
<button
class="secondary-button"
@@ -88,9 +88,9 @@ export function useSetupWizard(props, emit) {
email_retry_intervals_secs: "30,120,600",
recipients: "",
dns_provider: props.status.dns_provider || "aliyun",
propagation_timeout_secs: props.status.propagation_timeout_secs || 900,
propagation_timeout_secs: props.status.propagation_timeout_secs || 300,
propagation_polling_interval_secs:
props.status.propagation_polling_interval_secs || 10,
props.status.propagation_polling_interval_secs || 5,
certificate_root: props.status.certificate_root || "",
web_hostname: props.status.web_hostname || "",
web_public_ip: props.status.web_public_ip || "",
@@ -8,6 +8,8 @@ test("全新初始化默认选择阿里云", async (t) => {
const { state } = await mountComposable(t, () => useSetupWizard({ status: {} }, () => {}),
async () => Response.json({ items: [aliyunProvider] }));
assert.equal(state.form.value.dns_provider, "aliyun");
assert.equal(state.form.value.propagation_timeout_secs, 300);
assert.equal(state.form.value.propagation_polling_interval_secs, 5);
});
test("已有初始化服务商选择保持兼容", async (t) => {
@@ -111,13 +113,11 @@ test("初始化修改 DNS 输入后会停止等待计时器", async (t) => {
await task;
});
test("初始化修改显式授权范围立即作废旧验证", async (t) => {
test("初始化修改阿里云凭据立即作废旧验证", async (t) => {
const { state } = await setup(t, () => verifiedResponse());
state.dnsCredentials.value.managed_zones = "example.test";
state.dnsCredentials.value.allowed_domains = "example.test";
await state.testDNS();
assert.equal(state.dnsVerificationValid.value, true);
state.dnsCredentials.value.allowed_domains = "*.example.test";
state.dnsCredentials.value.access_key_id = "changed-key";
assert.equal(state.dnsVerificationValid.value, false);
assert.equal(state.dnsVerification.value, null);
});
@@ -693,7 +693,7 @@ const {
max="86400"
required
/>
<small>默认 900 秒,最长允许等待 86400 秒。</small>
<small>默认 300 秒,最长允许等待 86400 秒。</small>
</label>
<label>
<span>DNS 传播检测间隔(秒)</span>
@@ -706,9 +706,14 @@ const {
:max="form.propagation_timeout_secs"
required
/>
<small>默认 6 秒,不能大于最大等待时间。</small>
<small>默认 5 秒,不能大于最大等待时间。</small>
</label>
</div>
<p class="field-hint">
阿里云 RAM 权限验证最多等待 6 秒:系统会创建、查询并清理临时 TXT
记录。以上 300 秒和 5 秒用于实际申请证书时的公网 DNS-01
传播等待与轮询。
</p>
<p v-if="dnsCatalogError" class="inline-error">
{{ dnsCatalogError }}
</p>