MCPcopy Index your code
hub / github.com/coder/coder / TestPortOffset

Function TestPortOffset

scripts/develop/main_test.go:149–171  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

147}
148
149func TestPortOffset(t *testing.T) {
150 t.Parallel()
151
152 root := "/tmp/coder/worktree-a"
153 offset := portOffset(root)
154 assert.Equal(t, offset, portOffset(root))
155 assert.GreaterOrEqual(t, offset, 0)
156 assert.Less(t, offset, 1000)
157 assert.Equal(t, 0, offset%10)
158
159 var foundDifferent bool
160 for _, otherRoot := range []string{
161 "/tmp/coder/worktree-b",
162 "/tmp/coder/worktree-c",
163 "/tmp/coder/worktree-d",
164 } {
165 if portOffset(otherRoot) != offset {
166 foundDifferent = true
167 break
168 }
169 }
170 assert.True(t, foundDifferent, "expected typical worktree paths to use different offsets")
171}
172
173func TestApplyPortOffsetSkipsExplicitPorts(t *testing.T) {
174 t.Parallel()

Callers

nothing calls this directly

Calls 3

portOffsetFunction · 0.85
LessMethod · 0.80
EqualMethod · 0.45

Tested by

no test coverage detected