36 Commits

Author SHA1 Message Date
Manjunath Kumatagi
0bc46ec92c
fix TestSignal test
Signed-off-by: Manjunath A Kumatagi <mkumatag@in.ibm.com>
2022-11-25 12:50:02 +05:30
Thomas Jungblut
5b163aa507 Expect exit code enhancement
ExpectProcess and ExpectFunc now take the exit code of the process into
account, not just the matching of the tty output.

This also refactors the many tests that were previously succeeding on
matching an output from a failing cmd execution.

Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
2022-11-14 11:19:41 +01:00
Marek Siarkowicz
069e26e284 tests: Validate etcd linearizability
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-10-23 06:41:38 +02:00
demoManito
a281bb0494 pkg: replace the deprecated Expect with ExpectWithContext in pkg/expect/expect_test.go
Signed-off-by: demoManito <1430482733@qq.com>
2022-09-16 14:39:14 +08:00
Marek Siarkowicz
157ee32da4 test: Clean incorrectly used StopSignal field from expect
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-09-13 15:22:45 +02:00
Marek Siarkowicz
1038c2f45c tests: Extract expect configuration into struct
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2022-09-13 09:20:35 +02:00
Marek Siarkowicz
f36a8782f0
Merge pull request #14345 from nic-chen/tests/watch
tests: Migrate watch test to common framework
2022-08-25 13:35:34 +02:00
Benjamin Wang
82bf79d4ce
Merge pull request #14376 from biosvs/fix-expect-package
Fixed infinite loop in ExpectProcess.ExpectFunc
2022-08-25 05:29:30 +08:00
Vitalii Levitskii
71c5360f98 Fixed infinite loop in ExpectProcess.ExpectFunc
Signed-off-by: Vitalii Levitskii <vitalii@uber.com>
2022-08-24 16:46:24 +03:00
nic-chen
f6ed36372b tests: Migrate watch test to common framework
Signed-off-by: nic-chen <chenjunxu6@gmail.com>
2022-08-22 21:55:57 +08:00
Thomas Jungblut
51933a7c8b Add test name to e2e cluster members
This should aid in debugging test flakes, especially in tests where the process is restarted very often and thus changes its pid.
Now it's a lot easier to grep for different members, also when different tests fail at the same time.
The test TestDowngradeUpgradeClusterOf3 as mentioned in #13167 is a good example for that.

Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
2022-08-01 15:57:16 +02:00
Thomas Jungblut
eb59368440 Reduce ExpectFunc polling interval.
Fixes issue 14275, flakes close to timeout like TestKVDelete.

Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
2022-07-28 14:38:44 +02:00
Eval EXEC
e2bff7cfe1
pkg/expect: send SIGTERM to target expect process instead of SIGKILL
Signed-off-by: Eval EXEC <execvy@gmail.com>
2022-06-26 16:39:30 +08:00
Marek Siarkowicz
e5bf23037a tests: Keeps log in expect to allow their analysis 2022-03-31 21:02:36 +02:00
Danielle Lancashire
a045e4bbfc expect_test: Look up binaries from the path
Not all systems include binaries in the same location. On my (NixOS, so
albeit a little weird) system these binaries exist in very different
locations.

This test switches to looking up the paths from the users PATH or skips
the test if they do not exist to improve the `make test` experience on
such systems.
2022-03-17 12:55:08 +00:00
cuishuang
b7824b794b fix some typos
Signed-off-by: cuishuang <imcusg@gmail.com>

fix some typos

Signed-off-by: cuishuang <imcusg@gmail.com>
2022-03-07 20:28:53 +08:00
Piotr Tabor
2ad893b110 Integrate verification into e2e tests. 2021-04-29 11:51:24 +02:00
wpedrak
dac6e37ea1 *: over 20 staticcheck fixes 2021-03-18 15:06:17 +01:00
Piotr Tabor
de67806175 mend 2021-03-14 13:35:47 +01:00
Piotr Tabor
67491a00ea e2e/expect: In case of sut process failure, print last 40lines of logs. 2021-03-13 23:41:29 +01:00
Piotr Tabor
b151a47d1b tests/e2e: Update github.com/creack/pty v1.1.7 -> v1.1.11
The fix is needed to mitigate consequences of
https://github.com/golang/go/issues/29458 "golang breaking change" that
causes following test failures on etcd end:

--- FAIL: TestCtlV2Set (0.00s)
    ctl_v2_test.go:552: could not start etcd process cluster (fork/exec ../../bin/etcd: Setctty set but Ctty not valid in child)
--- FAIL: TestCtlV2SetQuorum (0.00s)
    ctl_v2_test.go:552: could not start etcd process cluster (fork/exec ../../bin/etcd: Setctty set but Ctty not valid in child)
--- FAIL: TestCtlV2SetClientTLS (0.00s)
    ctl_v2_test.go:552: could not start etcd process cluster (fork/exec ../../bin/etcd: Setctty set but Ctty not valid in child)
2020-08-04 16:12:12 +02:00
Gyuho Lee
46166ad733 vendor: update
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-07-24 14:09:50 -07:00
Gyuho Lee
1caaa9ed4a test: test update for Go 1.12.5 and related changes
Update to Go 1.12.5 testing. Remove deprecated unused and gosimple
pacakges, and mask staticcheck 1006. Also, fix unconvert errors related
to unnecessary type conversions and following staticcheck errors:
- remove redundant return statements
- use for range instead of for select
- use time.Since instead of time.Now().Sub
- omit comparison to bool constant
- replace T.Fatal and T.Fatalf in tests with T.Error and T.Fatalf respectively because the goroutine calls T.Fatal must be called in the same goroutine as the test
- fix error strings that should not be capitalized
- use sort.Strings(...) instead of sort.Sort(sort.StringSlice(...))
- use he status code of Canceled instead of grpc.ErrClientConnClosing which is deprecated
- use use status.Errorf instead of grpc.Errorf which is deprecated

Related #10528 #10438
2019-06-05 17:02:05 -04:00
Gyuho Lee
b2a15ec327 pkg/expect: fix deadlock in mac OS
bufio.NewReader.ReadString blocks even
when the process received syscall.SIGKILL.
Remove ptyMu mutex and make ReadString return
when *os.File is closed.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-01 17:34:59 -08:00
Anthony Romano
71d7c85b6b expect: reload DEBUG_EXPECT for each process
Lets e2e test cases selectively turn on expect debugging to get
full application output written to stdout.
2017-05-11 16:09:31 -07:00
fanmin shi
07129a6370 *: add and expose StopSignal field in ExpectProcess
add and expose StopSignal to ExpectProcess allows user
to define what signal to send on ExpectProcess.close()

coverage testing code sets StopSignal to SIGTERM allowing
the test binary to shutdown gracefully so that it can generate
a coverage report.
2017-02-17 14:47:06 -08:00
fanmin shi
1d521556ae e2e: modify e2e to run code coverage 2017-02-15 09:51:50 -08:00
Anthony Romano
cf382dbe60 expect: EXPECT_DEBUG environment variable
Dump process output to stdout when EXPECT_DEBUG != "".
2017-01-06 11:09:06 -08:00
Gyu-Ho Lee
8b77de4e99 pkg: update LICENSE header 2016-05-12 20:48:53 -07:00
Anthony Romano
fcb5ba98d0 pkg/expect: support sending Signals to expect process 2016-04-13 09:11:57 -07:00
Xiang Li
9c7fb9c360 *: fix misspell 2016-04-07 21:57:06 -07:00
Gyu-Ho Lee
679e5e379b pkg/expect: ExpectFunc, LineCount
ExpectFunc to make expect more extensible. LineCount to be
able to check 'no output' command.
2016-04-06 15:56:00 -07:00
Anthony Romano
dc420d660e e2e, pkg/expect: distinguish between Stop and Close
Fixes #4928
2016-04-03 11:45:02 -07:00
Gyu-Ho Lee
f4eaa3f8fb pkg/expect: replace SendLine with Send method 2016-04-03 10:57:35 -07:00
Gyu-Ho Lee
d898c68f2c pkg/expect: add SendLine for interactive mode 2016-03-31 15:34:30 -07:00
Anthony Romano
5707f6b997 pkg/expect: add expect package 2016-03-30 15:14:24 -07:00