|
1 | 1 | package commands
|
2 | 2 |
|
3 | 3 | import (
|
| 4 | + "github.com/chermehdi/egor/config" |
| 5 | + "github.com/chermehdi/egor/utils" |
| 6 | + "github.com/stretchr/testify/assert" |
4 | 7 | "os/exec"
|
5 | 8 | "testing"
|
6 |
| - |
7 |
| - "github.com/stretchr/testify/assert" |
8 | 9 | )
|
9 | 10 |
|
10 | 11 | func TestTimedOutExecution(t *testing.T) {
|
11 | 12 | cmd := exec.Command("sleep", "1.1")
|
12 |
| - status, _, err := timedExecution(cmd, 1000+TimeOutDelta) |
| 13 | + status, _, err := utils.ExecuteWithTimeout(cmd, 1000+config.TimeOutDelta) |
13 | 14 | assert.Equal(t, err, nil)
|
14 |
| - assert.Equal(t, status, TO) |
| 15 | + assert.Equal(t, status, config.TO) |
15 | 16 | }
|
16 | 17 |
|
17 | 18 | func TestTimedExecution(t *testing.T) {
|
18 | 19 | cmd := exec.Command("sleep", "1")
|
19 |
| - status, _, err := timedExecution(cmd, 1000+TimeOutDelta) |
| 20 | + status, _, err := utils.ExecuteWithTimeout(cmd, 1000+config.TimeOutDelta) |
20 | 21 | assert.Equal(t, err, nil)
|
21 |
| - assert.Equal(t, status, OK) |
| 22 | + assert.Equal(t, status, config.OK) |
22 | 23 | }
|
23 | 24 |
|
24 | 25 | func TestChecker_TokenBasedCheckerShouldIgnoreSpaces(t *testing.T) {
|
|
0 commit comments