Commit Graph

36 Commits

Author SHA1 Message Date
Andrew Melnick
488518d957 Enable binary support for WSClient
Currently, under python 3, the WSClient decodes all data via UTF-8. This
will break, e.g. capturing the stdout of tar or gzip.
This adds a new 'binary' kwarg to the WSClient class and websocket_call
function. If this is set to true, then the decoding will not happen, and
all channels will be interpreted as binary.
This does raise a slight complication, as the OpenAPI-generated client
will convert the output to a string, no matter what, which it ends up
doing by (effectively) calling repr(). This requires a bit of magic to
recover the orignial bytes, and is inefficient. However, this is only
the case when using the default _preload_content=True, setting this to
False and manually calling read_all or read_channel, this issue does not
arise.
2024-02-28 15:41:24 -07:00
Pedro Lopez Mareque
f7fc9deb18 remove old assertion and improve tests 2022-09-27 08:54:41 +02:00
Pedro Lopez Mareque
c8d814ddce fix tests 2022-09-27 08:36:56 +02:00
Pedro Lopez Mareque
89730b40d4 Run autopep8 and fix style 2022-09-27 07:38:23 +02:00
Pedro Lopez Mareque
1da8a689dd fechange e2e test strategy to add instead of replace 2022-09-26 22:42:24 +02:00
Pedro Lopez Mareque
2fd1b9469c feat: add missing e2e test for json and merge patch strategies 2022-09-26 22:39:38 +02:00
Patrick J McNerthney
7d0cd172bf It turns out SSL sockets can buffer data such that the select method is not aware of it. See:
https://docs.python.org/3/library/ssl.html#notes-on-non-blocking-sockets
  https://docs.python.org/3/library/ssl.html#ssl.SSLSocket.pending
2022-05-01 06:42:31 -10:00
Yu Liao
6ae9260e9e Fixed test flakiness, added loop to wait for non-empty response line. 2022-01-04 12:14:02 -08:00
Aurélien Gasser
a24d1be63d
add comment 2021-12-13 19:43:29 -05:00
Aurélien Gasser
8da0080c7d
test: WSClient.returncode idempotence 2021-12-13 19:31:22 -05:00
Andrei Marin
740cda6998
Fix replication controller pods delete in tests 2021-10-06 22:04:26 +03:00
Andrei Marin
4cb2a51021
Run autopep8 on e2e test files 2021-10-06 22:04:25 +03:00
Nabarun Pal
73f119aa7a
Skipping TestClient::test_portforward_raw due to flakiness
The test is flaking a lot resulting in dev work to be slowed down.
This needs to be investigated and resolved. Only then, the test
should be reenabled.

See: https://github.com/kubernetes-client/python/issues/1300

Signed-off-by: Nabarun Pal <pal.nabarun95@gmail.com>
2021-05-28 22:49:17 +05:30
Haowei Cai
90931037ac pod e2e: wait for the default service account to be created 2021-01-12 17:18:42 -08:00
Haowei Cai
3b95adc8f3 configmap-e2e: use labels 2021-01-11 12:34:14 -08:00
Patrick J. McNerthney
fd405e813d Implement back end raw port test container using python. 2020-11-22 10:26:43 -10:00
Patrick J. McNerthney
c1249c9cf2 Support both python 2.7 and 3.x. 2020-09-07 19:47:19 -10:00
Patrick J. McNerthney
8afcebdf8d Add test that checks for portforward port error return value. 2020-09-07 13:11:50 -10:00
Patrick J. McNerthney
49f3b6e0b5 Rework port forwarding unittest and example. 2020-09-07 07:54:47 -10:00
Patrick J. McNerthney
fada718edf Unittests and example for portforwarding ability added in python-base. 2020-09-01 18:32:48 -10:00
micw523
02232a2e22 Change apis to api 2019-12-18 15:38:27 -06:00
Oz Tiram
752373b1f9 Test getting the returncode of execution in a pod
This tests demonstrate how to execute a command in a pod and
what behavior is expected. As discussed in the commit
bf367ed6ddc63369f76df0a07b248a6711328605 in python-base this
behavior would be familiar to Python users, as `subprocess.Popen`
has the same property.
2019-09-19 10:03:43 +02:00
Haowei Cai
a5ad719bcf Fix e2e test to reflect service storage refactoring 2018-03-12 15:21:38 -07:00
mbohlool
1d27f7e71b Fix end to end tests 2017-10-09 17:15:34 -07:00
mbohlool
27ba35aa81 Use stream module to call exec/attach calls 2017-09-22 11:42:59 -07:00
Jean Raby
c3d3ea82d2 Support for v4 stream protocol
- Set Sec-WebSocket-Protocol header from cfg param
- Add ERROR and RESIZE websocket channels
  As defined in pkg/kubelet/server/remotecommand/websocket.go
- Adjust tests to show v4 behavior wtr to status message
- Tweak read_all() to return only data from stdout and stderr.
2017-07-26 15:31:25 -04:00
mbohlool
4e593a7530 Improvements on ws_client. Now the client can returns an object to interact with websocket server and reach each channel separately 2017-02-21 12:55:37 -08:00
Davanum Srinivas
353e8ccdc8 Switch to minikube/localkube
* Drop the old Kubernetes on docker containers method as it
  did not have a SSL enabled port
* Use localkube component from minikube instead. This enables
  us to drop the hitch TLS proxy as well.
* E2E tests should be easy to run locally and pick up configuration
  from ~/.kube/config
* Consolidate the urls in one spot (base.py), also consolidate the
  SkipTest in one spot.
* For local testing, just run minikube and run the py27 or py34 tox
  target, that should run all the tests including the e2e tests.
* Fix the connect_post_namespaced_pod_exec and add a e2e test for it

Fixes #122
2017-02-09 15:49:04 -05:00
Davanum Srinivas
066bba1802 Implementation for /exec using websocket
inspired by the POC from @chekolyn

* Adds a new requirement on websocket-client
* Add a new class WSClient that uses WebSocketApp from
  the websocket-client.
* Make sure we pass Authorization header
* Make sure we honor the SSL settings in configuration
* Some of the code will get overwritten when we generate
  fresh classes from swagger definition. To remind us
  added a e2e test so we don't lose the changes
* Added a new configuration option to enable/disable failures
  when hostnames in certificates don't match

Fixes #58
2017-02-07 16:48:26 -05:00
Davanum Srinivas
96cfceb2f0 Run e2e tests against against https url
Use hitch tls proxy to listen on 8443 port and forward the
traffic to 8080. Add a configuration option to ignore any
issues with host names as we don't generate the cert on the
fly.
2017-02-03 12:16:58 -05:00
Davanum Srinivas
38aaec0f47 Refactor tests
* separate batch, extensions and the regular apis into separate
* added delete for some tests
* drop '_' for is_k8s_running
* remove comments that do not add value
2017-01-26 09:11:07 -05:00
Davanum Srinivas
03731f1003 Add e2e for deployment and daemonsets 2017-01-25 17:00:05 -05:00
Davanum Srinivas
cf5d796cf4 Ability to run e2e tests multiple times 2017-01-25 16:02:06 -05:00
Davanum Srinivas
1e48433b15 Fix ValueError in list_namespaced_config_map
Make sure we set an empty dict/list if we don't get
any data from the server

Fixes #104
2017-01-23 11:41:48 -05:00
Davanum Srinivas
9c6c96564b Fix for patch_* to work
Hack/workaround to get patch_namespaced_config_map and patch_namespaced_service
etc to work by essentially switching over the content-type from:
application/json-patch+json
to:
application/strategic-merge-patch+json

Fixes #93
2017-01-20 21:41:59 -05:00
Davanum Srinivas
28181d7ee9 cleanup: rename k8sclient->client 2017-01-16 14:45:02 -05:00