summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2019-01-05 12:21:37 +0300
committerWolfy-J <[email protected]>2019-01-05 12:21:37 +0300
commit46009112a783a1fdae95e0a061d4c8c41a1c8ff1 (patch)
treea34cf8ad465e9f354723f855c531ea1db3235cbd /util
parentd5e5be00aca87ea39ece9c04efe7dc354b1dc3f6 (diff)
first set of patches
Diffstat (limited to 'util')
-rw-r--r--util/fasttime.go5
-rw-r--r--util/fasttime_test.go1
-rw-r--r--util/state_test.go31
3 files changed, 37 insertions, 0 deletions
diff --git a/util/fasttime.go b/util/fasttime.go
new file mode 100644
index 00000000..a18924cb
--- /dev/null
+++ b/util/fasttime.go
@@ -0,0 +1,5 @@
+package util
+
+// FastTime provides current unix time using specified resolution with reduced number of syscalls.
+type FastTime struct {
+}
diff --git a/util/fasttime_test.go b/util/fasttime_test.go
new file mode 100644
index 00000000..c7d86821
--- /dev/null
+++ b/util/fasttime_test.go
@@ -0,0 +1 @@
+package util
diff --git a/util/state_test.go b/util/state_test.go
new file mode 100644
index 00000000..2e988e5e
--- /dev/null
+++ b/util/state_test.go
@@ -0,0 +1,31 @@
+package util
+
+import (
+ "github.com/spiral/roadrunner"
+ "github.com/stretchr/testify/assert"
+ "runtime"
+ "testing"
+ "time"
+)
+
+func TestServerState(t *testing.T) {
+ rr := roadrunner.NewServer(
+ &roadrunner.ServerConfig{
+ Command: "php ../tests/client.php echo tcp",
+ Relay: "tcp://:9007",
+ RelayTimeout: 10 * time.Second,
+ Pool: &roadrunner.Config{
+ NumWorkers: int64(runtime.NumCPU()),
+ AllocateTimeout: time.Second,
+ DestroyTimeout: time.Second,
+ },
+ })
+ defer rr.Stop()
+
+ assert.NoError(t, rr.Start())
+
+ state, err := ServerState(rr)
+ assert.NoError(t, err)
+
+ assert.Len(t, state, runtime.NumCPU())
+}