Commit graph

68 commits

Author SHA1 Message Date
Sebastiaan van Stijn
6345208b9b
Replace some checkers and assertions with gotest.tools
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-05 16:45:37 +02:00
Kir Kolyshkin
83363fb2d4 integration: use %s for check.Commentf()
It is wrong to pass an arbitrary string to a function expecting
%-style formatting. One solution would be to replace any % with %%,
but it's easier to just do what this patch does.

Generated with:

for f in $(git grep -l 'check.Commentf(out)'); do \
	sed -i -e 's/check\.Commentf(out)/check.Commentf("%s", out)/g' $f; \
done

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-08-14 10:45:39 +03:00
Sebastiaan van Stijn
ddd8a6572d
Fix ineffassign linting
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-11 22:18:45 +02:00
Vincent Demeester
3845728524
Update tests to use gotest.tools 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-13 09:04:30 +02:00
Kenfe-Mickael Laventure
617f89b9a3
Fix tests creating zombie processes
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-10-20 07:11:38 -07:00
Kenfe-Mickael Laventure
ddae20c032
Update libcontainerd to use containerd 1.0
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-10-20 07:11:37 -07:00
Daniel Nephin
27cfa68af1 Move RFC3339NanoFixed to a more appropriate package.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-25 16:07:24 -04:00
Kir Kolyshkin
14f0a1888f integration-cli/docker_cli_logs_test.go: Wait()
To avoid a zombie apocalypse, use cmd.Wait() to properly finish
the processes we spawn by Start().

Found while investigating DockerSuite.TestLogsFollowSlowStdoutConsumer
failure on ARM (see
https://github.com/moby/moby/pull/34550#issuecomment-324937936).

[v2: don't expect no error from Wait() when process is killed]

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2017-09-18 11:18:36 -07:00
Kir Kolyshkin
1bc93bff22 TestLogsFollowSlowStdoutConsumer: fix for slow ARM
We run our CI on Scaleway C1 machine, which is pretty slow,
including I/O. This test was failing on it, as it tried to
write 100000 lines of log very fast, and the loggerCloseTimeout
(defined and used in container/monitor.go) prevents the
daemon to finish writing it within this time frame,

Reducing the size to 150000 characters (75000 lines) should
help avoiding hitting it, without compromising the test case
itself.

Alternatively, we could have increased the timeout further. It was
originally set to 1s (commit b6a42673a) and later increased 10x
(commit c0391bf55). Please let me know if you want me to go that way.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2017-09-18 08:47:55 -07:00
Daniel Nephin
92427b3a81 Update tests to use icmd
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-25 12:07:30 -04:00
Daniel Nephin
9db68f4dea Remove RandomTmpDirPath
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-22 17:15:26 -04:00
Daniel Nephin
1455086c4b Remove ConsumeWithSpeed
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-22 17:15:26 -04:00
Vincent Demeester
eeaa6c96d8
[test-integration] Migrate some more tests to cli package
Add some required command operators to the `cli` package, and update
some tests to use this package, in order to remove a few functions
from `docker_utils_test.go`

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-03-28 15:17:31 +02:00
Vincent Demeester
c10f6ef43f
Clean more build utils in integration cli
- Remove deprecated buildImage* functions
- Rename buildImageNew to buildImage
- Use *check.C in fakeContext* setup and in getIdByName

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-01-17 15:42:38 +01:00
Vincent Demeester
9af5d7c340
Small cleanups on integration cli
- Join a few tests in one when it makes sense (reduce the number of
  container run and thus the overall time of the suites)
- Remove some duplication on several tests
- Remove some unused methods

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-01-12 16:57:59 +01:00
Tonis Tiigi
1e98fb5ad9 Fix leaked connections in integration tests
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-01-11 14:48:48 -08:00
Vincent Demeester
303b1d200a
Update trustedCmd to be compatible with testutil/cmd
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-01-09 11:07:05 +01:00
Vincent Demeester
87e3fcfe1e
Clean some runCommandWithOutput accross integration-cli code
There is still ways to go

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-01-05 17:44:31 +01:00
Vincent Demeester
33968e6c7d
Remove pkg/integration and move it to testutil or integration-cli
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-12-30 18:26:34 +01:00
Vincent Demeester
def13fa23c
Clean integration-cli/utils.go from most of its content
Most of the code is now on pkg/integration.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-12-28 19:05:48 +01:00
Sebastiaan van Stijn
05dc9846e1
remove client-side for supported logging drivers
The `docker logs` command performed a
client-side check if the container's
logging driver was supported.

Now that we allow the client to connect
to both "older" and "newer" daemon versions,
this check is best done daemon-side.

This patch remove the check on the client
side, and leaves validation to the daemon,
which should be the source of truth.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-12-19 14:30:01 +01:00
Shayne Wang
63904eb674 Change reading order of tailfile
change reading order from beginning at the end to beginning at a buffer start
added intergration tests for boundary cases
Removed whitespace
Signed-off-by: Shayne Wang <shaynexwang@gmail.com>
2016-11-13 20:08:51 -08:00
Brian Goff
bd9d14a07b Add support for reading logs extra attrs
The jsonlog logger currently allows specifying envs and labels that
should be propagated to the log message, however there has been no way
to read that back.

This adds a new API option to enable inserting these attrs back to the
log reader.

With timestamps, this looks like so:
```
92016-04-08T15:28:09.835913720Z foo=bar,hello=world hello
```

The extra attrs are comma separated before the log message but after
timestamps.

Without timestaps it looks like so:
```
foo=bar,hello=world hello
```

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-05-06 20:42:20 -04:00
John Howard
acaef7caaf Windows: Fix flakey LogsSinceFutureFollow
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-04-12 13:27:29 -07:00
John Howard
b0e24c7393 Windows: Remove TP4 support from test code
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-04-11 15:36:31 -07:00
Alexander Morozov
0c7c9df804 integration-cli: move goroutines info helpers to separate funcs
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-03-14 15:52:56 -07:00
Brian Goff
3d42393e7f Merge pull request #21161 from Microsoft/jjh/TestLogsPerformanceProblem
Windows: Improve TestLogsContainers performance
2016-03-14 13:04:16 -04:00
John Howard
8ff884548f Fix TestLogsContainers performance
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-03-12 16:15:14 -08:00
Christopher Jones
2a02914892 Fix error-checking when looking at empty log
Fixes a bug when the log output is empty.

The length of a slice containing an empty string is 1, not 0, so
the test fails to catch when the log is empty. Instead, take a look at
out, which is just a string.

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
2016-03-11 15:09:00 -05:00
Antonio Murdaca
e44689139d integration-cli: remove not necessary -d again
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-02-28 13:48:15 +01:00
John Howard
10bd587d77 Windows CI: Port docker_cli_logs_test.go
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-02-24 20:19:48 -08:00
Arnaud Porterie
4928121992 Fix flaky TestLogsSinceFutureFollow
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2016-02-16 13:49:44 -08:00
David Calavera
27220ecc6b Move timeutils functions to the only places where they are used.
- Move time json marshaling to the jsonlog package: this is a docker
  internal hack that we should not promote as a library.
- Move Timestamp encoding/decoding functions to the API types: This is
  only used there. It could be a standalone library but I don't this
it's worth having a separated repo for this. It could introduce more
complexity than it solves.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-15 14:56:14 -05:00
David Calavera
0876742646 Implement docker logs with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:55 -05:00
Aaron Lehmann
7ab0f9bf61 Fix flaky test TestLogsSince
This test can fail if it is run close to a second boundary:

    FAIL: docker_cli_logs_test.go:169: DockerSuite.TestLogsSince

    docker_cli_logs_test.go:183:
        c.Assert(out, checker.Not(checker.Contains), v,
    check.Commentf("unexpected log message returned, since=%v", since))
    ... obtained string = "" +
    ...     "2015-12-07T19:54:45.000551883Z 1449518084 log2\n" +
    ...     "2015-12-07T19:54:47.001310929Z 1449518086 log3\n"
    ... substring string = "log2"
    ... unexpected log message returned, since=1449518085

The problem is that it generates log lines using date +%s and uses that
timestamp as a reference for log filtering with (--since) later on in
the test. However, the timestamp that date +%s generates may not match
the log timestamp.

This commit changes the test to parse the log timestamp itself instead
of relying on a parallel timestamp.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-12-07 13:26:30 -08:00
Wen Cheng Ma
c424c8c32c Correct the message of ErrorCodeNoSuchContainer to "No such container"
Fixes issue #18424

Signed-off-by: Wen Cheng Ma <wenchma@cn.ibm.com>
2015-12-04 15:00:08 +08:00
Mike Brown
430d8ff611 modifying docker --since and --until to support nanoseconds and time zones
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2015-11-13 09:56:15 -06:00
Srini Brahmaroutu
2046ba3e3c GCCGO requires more memory and time to start containers, fixing GCCGO x86 CI
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2015-10-26 19:09:00 +00:00
Jian Zhang
946e8cde53 Use c.Assert in integration-cli/docker_cli_logs_test.go
Signed-off-by: Jian Zhang <zhangjian.fnst@cn.fujitsu.com>
2015-10-15 10:53:19 +08:00
Morgan Bauer
1eecc1e7e5
refactor logs to not use internal data structures
- refactor to make it easier to split the api in the future
 - additional tests for non existent container case

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
2015-10-07 15:44:16 -07:00
John Howard
f9a3558a9d Windows: Get Integration CLI running
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-09-04 12:32:40 -07:00
Veres Lajos
5146232723 typofix - https://github.com/vlajos/misspell_fixer
Signed-off-by: Veres Lajos <vlajos@gmail.com>
2015-08-07 23:25:49 +01:00
David Calavera
1c6fe58efc Merge pull request #14442 from cpuguy83/refactor_logdrvier_reader
Refactor log driver reader
2015-07-22 11:54:35 -07:00
Brian Goff
c0391bf554 Split reader interface from logger interface
Implement new reader interface on jsonfile.
Moves jsonlog decoding from daemon to jsonfile logger.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-07-21 20:47:31 -04:00
Lei
2e7daffd7b Minor fix of TestLogsStderrInStdout
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-07-21 20:37:14 +08:00
Lei
eef6eda7d2 Recfactor: Use dockerCmd when possible in integration-cli tests
Part of #14603
integration-cli/docker_cli_links_test.go (coolljt0725)
integration-cli/docker_cli_links_unix_test.go (coolljt0725)
integration-cli/docker_cli_logs_test.go (coolljt0725)
integration-cli/docker_cli_nat_test.go (coolljt0725)
integration-cli/docker_cli_network_test.go (coolljt0725)
integration-cli/docker_cli_stats_test.go (coolljt0725)
integration-cli/docker_cli_tag_test.go (coolljt0725)
integration-cli/docker_cli_top_test.go (coolljt0725)
integration-cli/docker_cli_version_test.go (coolljt0725)
integration-cli/docker_cli_wait_test.go (coolljt0725

Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-07-20 14:44:22 +08:00
Brian Goff
0c84604f54 Fix goroutine leak on logs -f with no output
Also noticed potential hang when only stdout or stderr are used with
follow=1

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-06-04 13:56:40 -07:00
Alexander Morozov
7fffcfff32 Merge pull request #13387 from cpuguy83/fix_ngroutine_test
Better checking for LogsFollowGoroutinesWithStdout
2015-05-21 12:31:57 -07:00
Brian Goff
2805ff1ece Better checking for LogsFollowGoroutinesWithStdout
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-05-21 14:13:01 -04:00
Lorenzo Fontana
086b514f6a Removed deleteContainer calls
Signed-off-by: Lorenzo Fontana <fontanalorenzo@me.com>
2015-05-20 08:38:23 +02:00