fixed bugs introduced by regex replacements and removed legacy tests

This commit is contained in:
AndReicscs
2026-06-21 16:03:41 +00:00
parent 79e18221c9
commit fb094fba29
4 changed files with 13 additions and 20 deletions
@@ -159,13 +159,6 @@ func TestDecodeManifestStrict(t *testing.T) {
assert.Contains(t, err.Error(), "unknown_field")
})
t.Run("Unsupported Schema Version", func(t *testing.T) {
badJson := `{}`
_, err := DecodeManifestStrict(strings.NewReader(badJson))
assert.Error(t, err)
assert.Contains(t, err.Error(), "unsupported schema version: 2.0")
})
t.Run("Valid Decode", func(t *testing.T) {
goodJson := `{ "deployment": {"image_repository": "test"}}`
_, err := DecodeManifestStrict(strings.NewReader(goodJson))
+1 -1
View File
@@ -89,7 +89,7 @@ func TestGetNodeDetailsStrictHashMatch(t *testing.T) {
InstalledSensors: []models.NodeSensor{
{
ID: "hw-sensor-test",
DeployedVersion: "", // Empty so it auto-selects the latest
DeployedVersion: "v1.0.0", // Older version so it triggers UpdateAvailable
},
},
}
+2 -2
View File
@@ -273,10 +273,10 @@ type EventDetails []EventDetail
func (ed EventDetails) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
buf.WriteString("{Key: ")
buf.WriteString("{")
for i, d := range ed {
if i > 0 {
buf.WriteString(", Value: ")
buf.WriteString(",")
}
key, _ := json.Marshal(d.Key)
val, _ := json.Marshal(d.Value)
+10 -10
View File
@@ -22,16 +22,16 @@ func TestClassify(t *testing.T) {
wantTrans bool
wantRetryDur time.Duration
}{
{Key: "Network Error", Value: errors.New("timeout"), 0, "", true, true, 0},
{Key: "Success OK", Value: nil, 200, "", false, false, 0},
{Key: "Success Created", Value: nil, 201, "", false, false, 0},
{Key: "Bad Request (Terminal)", Value: nil, 400, "", true, false, 0},
{Key: "Unauthorized (Terminal)", Value: nil, 401, "", true, false, 0},
{Key: "Not Found (Terminal)", Value: nil, 404, "", true, false, 0},
{Key: "Rate Limit (Transient)", Value: nil, 429, "10", true, true, 10 * time.Second},
{Key: "Malformed Retry-After", Value: nil, 429, "potato", true, true, 0},
{Key: "Server Error (Transient)", Value: nil, 500, "", true, true, 0},
{Key: "Bad Gateway (Transient)", Value: nil, 502, "30", true, true, 30 * time.Second},
{"Network Error", errors.New("timeout"), 0, "", true, true, 0},
{"Success OK", nil, 200, "", false, false, 0},
{"Success Created", nil, 201, "", false, false, 0},
{"Bad Request (Terminal)", nil, 400, "", true, false, 0},
{"Unauthorized (Terminal)", nil, 401, "", true, false, 0},
{"Not Found (Terminal)", nil, 404, "", true, false, 0},
{"Rate Limit (Transient)", nil, 429, "10", true, true, 10 * time.Second},
{"Malformed Retry-After", nil, 429, "potato", true, true, 0},
{"Server Error (Transient)", nil, 500, "", true, true, 0},
{"Bad Gateway (Transient)", nil, 502, "30", true, true, 30 * time.Second},
}
for _, tt := range tests {