(t *testing.T)
| 22 | ) |
| 23 | |
| 24 | func TestConnectionLog(t *testing.T) { |
| 25 | t.Parallel() |
| 26 | |
| 27 | var ( |
| 28 | owner = database.User{ |
| 29 | ID: uuid.New(), |
| 30 | Username: "cool-user", |
| 31 | } |
| 32 | workspace = database.Workspace{ |
| 33 | ID: uuid.New(), |
| 34 | OrganizationID: uuid.New(), |
| 35 | OwnerID: owner.ID, |
| 36 | Name: "cool-workspace", |
| 37 | } |
| 38 | agent = database.WorkspaceAgent{ |
| 39 | ID: uuid.New(), |
| 40 | } |
| 41 | ) |
| 42 | |
| 43 | tests := []struct { |
| 44 | name string |
| 45 | id uuid.UUID |
| 46 | action *agentproto.Connection_Action |
| 47 | typ *agentproto.Connection_Type |
| 48 | time time.Time |
| 49 | ip string |
| 50 | status int32 |
| 51 | reason string |
| 52 | }{ |
| 53 | { |
| 54 | name: "SSH Connect", |
| 55 | id: uuid.New(), |
| 56 | action: agentproto.Connection_CONNECT.Enum(), |
| 57 | typ: agentproto.Connection_SSH.Enum(), |
| 58 | time: dbtime.Now(), |
| 59 | ip: "127.0.0.1", |
| 60 | status: 200, |
| 61 | }, |
| 62 | { |
| 63 | name: "VS Code Connect", |
| 64 | id: uuid.New(), |
| 65 | action: agentproto.Connection_CONNECT.Enum(), |
| 66 | typ: agentproto.Connection_VSCODE.Enum(), |
| 67 | time: dbtime.Now(), |
| 68 | ip: "8.8.8.8", |
| 69 | }, |
| 70 | { |
| 71 | name: "JetBrains Connect", |
| 72 | id: uuid.New(), |
| 73 | action: agentproto.Connection_CONNECT.Enum(), |
| 74 | typ: agentproto.Connection_JETBRAINS.Enum(), |
| 75 | time: dbtime.Now(), |
| 76 | // Sometimes, JetBrains clients report as localhost, see |
| 77 | // https://github.com/coder/coder/issues/20194 |
| 78 | ip: "localhost", |
| 79 | }, |
| 80 | { |
| 81 | name: "Reconnecting PTY Connect", |
nothing calls this directly
no test coverage detected