Skip to content

Commit c1d82e8

Browse files
committed
Refactored config parser tests
1 parent b4723f8 commit c1d82e8

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

glide.lock

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

glide.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ import:
1313
version: ^0.8.0
1414
subpackages:
1515
- prometheus
16+
- package: github.com/otiai10/copy

pkg/phpfpm/config_test.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,21 @@ package phpfpm
33
import (
44
"testing"
55

6+
"github.com/otiai10/copy"
67
"github.com/stretchr/testify/assert"
8+
"os"
79
)
810

911
func TestParse(t *testing.T) {
10-
c, err := ParseConfig("testData/php-fpm.conf")
12+
dir := "/tmp/fpm-test"
13+
assert.NoError(t, os.Mkdir(dir, 0777))
14+
copy.Copy("testdata", dir)
15+
16+
defer os.RemoveAll(dir)
17+
18+
c, err := ParseConfig(dir + "/php-fpm.conf")
1119
assert.Nil(t, err)
12-
assert.Equal(t, "testData/php-fpm.d/*.conf", c.Include)
20+
assert.Equal(t, dir + "/php-fpm.d/*.conf", c.Include)
1321

1422
assert.Equal(t, "www", c.Pools[0].Name)
1523
assert.Equal(t, "/run/php-fpm/php-fpm.sock", c.Pools[0].Listen)

fpmConfig/testData/php-fpm.conf renamed to pkg/phpfpm/testdata/php-fpm.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,4 @@ error_log = syslog
122122
; Relative path can also be used. They will be prefixed by:
123123
; - the global prefix if it's been set (-p argument)
124124
; - /usr otherwise
125-
include=testData/php-fpm.d/*.conf
125+
include=/tmp/fpm-test/php-fpm.d/*.conf

fpmConfig/testData/php-fpm.d/www.conf renamed to pkg/phpfpm/testdata/php-fpm.d/www.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ listen = /run/php-fpm/php-fpm.sock
4444
; BSD-derived systems allow connections regardless of permissions.
4545
; Default Values: user and group are set as the running user
4646
; mode is set to 0660
47-
listen.owner = http
48-
listen.group = http
47+
;listen.owner = http
48+
;listen.group = http
4949
listen.mode = 0666
5050
; When POSIX Access Control Lists are supported you can set them using
5151
; these options, value is a comma separated list of user/group names.

0 commit comments

Comments
 (0)