Skip to content

Commit 2e94571

Browse files
committed
Fix Makefile venv commands and trust status handling
1 parent d06fa1f commit 2e94571

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ VENV ?= .venv
33
VENV_BIN := $(VENV)/bin
44
PYTHON_BIN := python3
55
PIP_BIN := pip
6-
FLAKE8_CMD := $(PYTHON_BIN) -m flake8
7-
MYPY_CMD := $(PYTHON_BIN) -m mypy
8-
BLACK_CMD := $(PYTHON_BIN) -m black
9-
ISORT_CMD := $(PYTHON_BIN) -m isort
10-
PYTEST_CMD := $(PYTHON_BIN) -m pytest
6+
FLAKE8_CMD = $(PYTHON_BIN) -m flake8
7+
MYPY_CMD = $(PYTHON_BIN) -m mypy
8+
BLACK_CMD = $(PYTHON_BIN) -m black
9+
ISORT_CMD = $(PYTHON_BIN) -m isort
10+
PYTEST_CMD = $(PYTHON_BIN) -m pytest
1111
GOLANGCI_LINT ?= golangci-lint
1212

1313
ifneq ($(wildcard $(VENV_BIN)/python3),)

agent/internal/posture/constants.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const (
2626
StatusCompliant = "compliant"
2727
StatusWarning = "warning"
2828
StatusCritical = "critical"
29+
StatusUnknown = "unknown"
2930

3031
TrustBonusOS = 20
3132
TrustBonusFirewall = 25

agent/internal/posture/posture.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (ts TrustStatus) String() string {
3232
case TrustStatusCritical:
3333
return StatusCritical
3434
default:
35-
return StatusCritical
35+
return StatusUnknown
3636
}
3737
}
3838

agent/internal/posture/posture_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,32 @@ func TestDevicePosture_CalculateTrustScore(t *testing.T) {
135135
}
136136
}
137137

138+
func TestTrustStatusUnknownStringAndJSON(t *testing.T) {
139+
var ts TrustStatus
140+
if ts != TrustStatusUnknown {
141+
t.Fatalf("zero value should be TrustStatusUnknown, got %v", ts)
142+
}
143+
if ts.String() != StatusUnknown {
144+
t.Fatalf("expected String() to return %q, got %q", StatusUnknown, ts.String())
145+
}
146+
147+
data, err := ts.MarshalJSON()
148+
if err != nil {
149+
t.Fatalf("MarshalJSON returned error: %v", err)
150+
}
151+
if string(data) != `"`+StatusUnknown+`"` {
152+
t.Fatalf("expected marshaled JSON %q, got %s", StatusUnknown, data)
153+
}
154+
155+
var decoded TrustStatus
156+
if err := decoded.UnmarshalJSON(data); err != nil {
157+
t.Fatalf("UnmarshalJSON returned error: %v", err)
158+
}
159+
if decoded != TrustStatusUnknown {
160+
t.Fatalf("expected decoded status to be TrustStatusUnknown, got %v", decoded)
161+
}
162+
}
163+
138164
// TestDevicePosture_ToJSON tests JSON serialization
139165
func TestDevicePosture_ToJSON(t *testing.T) {
140166
posture := &DevicePosture{

0 commit comments

Comments
 (0)