Skip to content

Commit ffce9de

Browse files
committed
test: fix a few test flakes
1 parent 2c74ed5 commit ffce9de

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

internal/io/library/init.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,22 @@ func (l *Library) Init() tea.Cmd {
4343
}
4444

4545
func (l *Library) setVisibleExecs() {
46+
l.mu.RLock()
4647
if len(l.allExecutables) == 0 || len(l.visibleWorkspaces) == 0 {
48+
l.mu.RUnlock()
4749
return
4850
}
4951

5052
curWs := l.filter.Workspace
5153

52-
l.mu.RLock()
5354
if label := l.visibleWorkspaces[l.currentWorkspace]; label != "" && label != allWorkspacesLabel {
5455
curWs = label
5556
} else if curWs == allWorkspacesLabel {
5657
curWs = ""
5758
}
58-
l.mu.RUnlock()
5959

6060
curNs := l.filter.Namespace
6161
if l.showNamespaces && len(l.visibleNamespaces) > 0 {
62-
l.mu.RLock()
6362
if label := l.visibleNamespaces[l.currentNamespace]; label != "" {
6463
switch label {
6564
case withoutNamespaceLabel:
@@ -70,8 +69,8 @@ func (l *Library) setVisibleExecs() {
7069
curNs = label
7170
}
7271
}
73-
l.mu.RUnlock()
7472
}
73+
l.mu.RUnlock()
7574

7675
filter := l.filter
7776
filteredExec := l.allExecutables
@@ -127,15 +126,16 @@ func (l *Library) setVisibleWorkspaces() {
127126
}
128127

129128
func (l *Library) setVisibleNamespaces() {
129+
l.mu.RLock()
130130
if l.allExecutables == nil || len(l.visibleWorkspaces) == 0 {
131+
l.mu.RUnlock()
131132
return
132133
}
133134

134135
var labels, prepend []string
135136
var someWithoutNs bool
136137
filter := l.filter
137138

138-
l.mu.RLock()
139139
filterWs := l.visibleWorkspaces[l.currentWorkspace]
140140
l.mu.RUnlock()
141141

tools/builder/request.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ func RequestExecWithTransform(opts ...Option) *executable.Executable {
6969
Request: &executable.RequestExecutableType{
7070
URL: "https://httpbin.org/get",
7171
TransformResponse: "status",
72+
ValidStatusCodes: []int{200, 503}, // TODO: use a mock server to avoid relying on external services
7273
},
7374
}
7475
if len(opts) > 0 {

0 commit comments

Comments
 (0)