v0.342.0 (unreleased): the upload watch reads the host's weekly line test (GET /host/line-test, agent >= 0.164.0); qBittorrent's limit = 50 % of the TESTED line only (D41), the watch uses the higher of test and push floor, the system page names the source; red-proved
gates / gates (push) Successful in 1m15s
gates / gates (push) Successful in 1m15s
This commit is contained in:
@@ -2361,6 +2361,7 @@ func (s *Server) systemPageData() map[string]interface{} {
|
||||
if s.upwatchView != nil {
|
||||
if v := s.upwatchView(); v.LineKnown {
|
||||
data["UplinkLine"] = upwatch.MbpsText(int64(v.LineMbps * 1e6 / 8))
|
||||
data["UplinkTested"] = v.LineTested
|
||||
}
|
||||
}
|
||||
data["GitRepoURL"] = s.cfg.Git.RepoURL
|
||||
|
||||
@@ -251,6 +251,7 @@ func i18nCasesA() []i18nCase {
|
||||
d["LastUpdateState"] = map[string]interface{}{"Status": "failed", "Error": "pull failed"}
|
||||
d["MemorySupported"], d["MemoryReachable"], d["MemoryProcMB"] = true, false, 4096
|
||||
d["PowerOffSupported"] = true
|
||||
d["UplinkLine"], d["UplinkTested"] = "91", true // R-1247: the weekly test's line (_full: the push floor)
|
||||
return d
|
||||
}},
|
||||
{"settings_system_pending", "settings_system", func() map[string]interface{} {
|
||||
|
||||
@@ -185,7 +185,7 @@
|
||||
</div>
|
||||
<div class="settings-row" data-uplink>
|
||||
<span class="settings-label">{{T "upwatch.line_label"}}</span>
|
||||
<span class="settings-value">{{if .UplinkLine}}{{T "upwatch.line_at_least"}} <span class="mono">{{.UplinkLine}}</span> {{T "upwatch.line_measured"}}{{else}}<span style="color:var(--text-3);">{{T "upwatch.line_learning"}}</span>{{end}}</span>
|
||||
<span class="settings-value">{{if and .UplinkLine .UplinkTested}}<span class="mono">{{.UplinkLine}}</span> {{T "upwatch.line_tested"}}{{else if .UplinkLine}}{{T "upwatch.line_at_least"}} <span class="mono">{{.UplinkLine}}</span> {{T "upwatch.line_measured"}}{{else}}<span style="color:var(--text-3);">{{T "upwatch.line_learning"}}</span>{{end}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="settings-card-desc" style="margin-top:0.5em;">{{T "settings_system.ezek_az_ertekek_a_helyi"}}</p>
|
||||
|
||||
@@ -305,7 +305,7 @@
|
||||
</div>
|
||||
<div class="settings-row" data-uplink>
|
||||
<span class="settings-label">Feltöltési sebesség</span>
|
||||
<span class="settings-value"><span style="color:var(--text-3);">még mérjük (az éjszakai távoli mentésből)</span></span>
|
||||
<span class="settings-value"><span class="mono">91</span> Mbit/s (heti sebességméréssel)</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="settings-card-desc" style="margin-top:0.5em;">Ezek az értékek a helyi hálózattól függenek és változhatnak. Távoli hibaelhárításnál erről az oldalról olvasd fel őket.</p>
|
||||
|
||||
@@ -53,3 +53,28 @@ func TestUpwatch_QBLimitLineOnQBittorrentsPageOnly(t *testing.T) {
|
||||
t.Fatal("no view wired, yet a line")
|
||||
}
|
||||
}
|
||||
|
||||
// The system page's upload line names its source: the weekly test („heti sebességméréssel") or the off-site push's floor
|
||||
// („legalább … az éjszakai távoli mentésből"), in the reader's language.
|
||||
// RED-PROOF: drop `data["UplinkTested"]` in systemPageData → the tested case reads „legalább" → fails.
|
||||
func TestUpwatch_SystemPageNamesTheLinesSource(t *testing.T) {
|
||||
s, _ := credsHarness(t)
|
||||
s.loadTemplates()
|
||||
render := func(lang string) string {
|
||||
rr := httptest.NewRecorder()
|
||||
s.settingsHandler(rr, httptest.NewRequest("GET", "/settings?lang="+lang, nil))
|
||||
return asciiFold(html.UnescapeString(rr.Body.String()))
|
||||
}
|
||||
view := upwatch.View{LineMbps: 90.7, LineKnown: true, LineTested: true}
|
||||
s.SetUpwatchView(func() upwatch.View { return view })
|
||||
if hu := render("hu"); !strings.Contains(hu, "heti sebessegmeressel") || strings.Contains(hu, "legalabb <span") {
|
||||
t.Fatal("tested line: the Hungarian system page does not say „heti sebességméréssel\"")
|
||||
}
|
||||
if en := render("en"); !strings.Contains(en, "Mbit/s (measured weekly)") {
|
||||
t.Fatal("tested line: the English system page does not say „measured weekly\"")
|
||||
}
|
||||
view = upwatch.View{LineMbps: 10, LineKnown: true}
|
||||
if hu := render("hu"); !strings.Contains(hu, "legalabb") || !strings.Contains(hu, "ejszakai tavoli mentesbol") || strings.Contains(hu, "heti sebessegmeressel") {
|
||||
t.Fatal("push floor: the Hungarian system page does not say „legalább … az éjszakai távoli mentésből\"")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user