From 8a05d4b0303fcdba17cc59d385807aaeda2471b0 Mon Sep 17 00:00:00 2001 From: Jian Qiu Date: Wed, 31 May 2023 14:34:06 +0800 Subject: [PATCH] Refactore integration test (#150) Signed-off-by: Jian Qiu --- Makefile | 2 +- go.mod | 12 +- go.sum | 25 +-- pkg/version/version.go | 15 -- .../placement}/benchmark_test.go | 4 +- test/{ => integration}/integration-test.mk | 10 +- .../operator}/clustermanager_hosted_test.go | 11 +- .../operator}/clustermanager_test.go | 4 +- .../operator}/doc.go | 2 +- .../operator}/integration_suite_test.go | 2 +- .../operator}/klusterlet_hosted_test.go | 5 +- .../operator}/klusterlet_test.go | 4 +- .../placement}/assertion_test.go | 4 +- .../placement}/placement_test.go | 4 +- .../placement}/prioritizer_test.go | 4 +- .../placement}/suite_test.go | 2 +- .../placement}/toleration_test.go | 4 +- .../registration}/addon_lease_test.go | 15 +- .../registration}/addon_registration_test.go | 6 +- .../certificate_rotation_test.go | 6 +- ...fault_managedclusterset_controller_test.go | 2 +- .../registration}/disaster_recovery_test.go | 9 +- .../registration}/doc.go | 2 +- ...lobal_managedclusterset_controller_test.go | 2 +- .../registration}/integration_suite_test.go | 20 +- .../managedcluster_deletion_test.go | 2 +- .../managedcluster_lease_test.go | 19 +- .../registration}/managedclusterset_test.go | 2 +- .../registration}/spokeagent_recovery_test.go | 13 +- .../registration}/spokeagent_restart_test.go | 17 +- .../spokecluster_autoapproval_test.go | 6 +- .../registration}/spokecluster_claim_test.go | 6 +- .../spokecluster_joining_test.go | 6 +- .../registration}/spokecluster_status_test.go | 6 +- .../registration}/taint_add_test.go | 4 +- test/{work => }/integration/util/assertion.go | 75 +++++++- .../util/authentication.go} | 152 +-------------- test/integration/util/certificate.go | 59 ++++++ test/integration/util/kubeconfig.go | 55 ++++++ test/integration/util/managedcluster.go | 82 ++++++++ .../util.go => integration/util/recorder.go} | 0 test/integration/util/structured.go | 105 ++++++++++ .../integration/util/unstructured.go | 0 .../work}/deleteoption_test.go | 4 +- .../integration => integration/work}/doc.go | 2 +- .../work}/executor_test.go | 4 +- .../work}/manifestworkreplicaset_test.go | 4 +- .../work}/statusfeedback_test.go | 4 +- .../work}/suite_test.go | 4 +- .../work}/unmanaged_appliedwork_test.go | 4 +- .../work}/updatestrategy_test.go | 4 +- .../work}/work_test.go | 38 +++- .../integration/util/assertion.go | 51 ----- .../integration/util/util.go | 152 --------------- test/work/integration/report.xml | 45 ----- test/work/integration/util/util.go | 182 ------------------ vendor/golang.org/x/net/html/doc.go | 20 +- vendor/golang.org/x/net/http2/pipe.go | 6 +- vendor/golang.org/x/net/http2/server.go | 7 +- vendor/golang.org/x/net/http2/transport.go | 41 ++-- vendor/golang.org/x/sys/unix/ioctl_signed.go | 70 +++++++ .../sys/unix/{ioctl.go => ioctl_unsigned.go} | 4 +- vendor/golang.org/x/sys/unix/ioctl_zos.go | 12 +- vendor/golang.org/x/sys/unix/mkerrors.sh | 5 +- vendor/golang.org/x/sys/unix/syscall_aix.go | 4 +- .../golang.org/x/sys/unix/syscall_aix_ppc.go | 1 - .../x/sys/unix/syscall_aix_ppc64.go | 1 - .../golang.org/x/sys/unix/syscall_darwin.go | 3 +- .../x/sys/unix/syscall_dragonfly.go | 1 - .../golang.org/x/sys/unix/syscall_freebsd.go | 1 - vendor/golang.org/x/sys/unix/syscall_linux.go | 10 +- .../x/sys/unix/syscall_linux_386.go | 27 --- .../x/sys/unix/syscall_linux_amd64.go | 1 - .../x/sys/unix/syscall_linux_arm.go | 27 --- .../x/sys/unix/syscall_linux_arm64.go | 10 - .../x/sys/unix/syscall_linux_loong64.go | 5 - .../x/sys/unix/syscall_linux_mips64x.go | 1 - .../x/sys/unix/syscall_linux_mipsx.go | 27 --- .../x/sys/unix/syscall_linux_ppc.go | 27 --- .../x/sys/unix/syscall_linux_ppc64x.go | 1 - .../x/sys/unix/syscall_linux_riscv64.go | 1 - .../x/sys/unix/syscall_linux_s390x.go | 1 - .../x/sys/unix/syscall_linux_sparc64.go | 1 - .../golang.org/x/sys/unix/syscall_netbsd.go | 2 - .../golang.org/x/sys/unix/syscall_openbsd.go | 1 - .../golang.org/x/sys/unix/syscall_solaris.go | 21 +- vendor/golang.org/x/sys/unix/syscall_unix.go | 7 + .../x/sys/unix/syscall_zos_s390x.go | 4 +- .../x/sys/unix/zerrors_darwin_amd64.go | 19 ++ .../x/sys/unix/zerrors_darwin_arm64.go | 19 ++ vendor/golang.org/x/sys/unix/zerrors_linux.go | 14 ++ .../golang.org/x/sys/unix/zsyscall_aix_ppc.go | 15 +- .../x/sys/unix/zsyscall_aix_ppc64.go | 18 +- .../x/sys/unix/zsyscall_aix_ppc64_gc.go | 10 - .../x/sys/unix/zsyscall_aix_ppc64_gccgo.go | 10 +- .../x/sys/unix/zsyscall_darwin_amd64.go | 39 ++-- .../x/sys/unix/zsyscall_darwin_amd64.s | 11 +- .../x/sys/unix/zsyscall_darwin_arm64.go | 39 ++-- .../x/sys/unix/zsyscall_darwin_arm64.s | 11 +- .../x/sys/unix/zsyscall_dragonfly_amd64.go | 10 - .../x/sys/unix/zsyscall_freebsd_386.go | 10 - .../x/sys/unix/zsyscall_freebsd_amd64.go | 10 - .../x/sys/unix/zsyscall_freebsd_arm.go | 10 - .../x/sys/unix/zsyscall_freebsd_arm64.go | 10 - .../x/sys/unix/zsyscall_freebsd_riscv64.go | 10 - .../golang.org/x/sys/unix/zsyscall_linux.go | 10 - .../x/sys/unix/zsyscall_linux_386.go | 10 - .../x/sys/unix/zsyscall_linux_amd64.go | 10 - .../x/sys/unix/zsyscall_linux_arm.go | 10 - .../x/sys/unix/zsyscall_linux_arm64.go | 10 - .../x/sys/unix/zsyscall_linux_mips.go | 10 - .../x/sys/unix/zsyscall_linux_mips64.go | 10 - .../x/sys/unix/zsyscall_linux_mips64le.go | 10 - .../x/sys/unix/zsyscall_linux_mipsle.go | 10 - .../x/sys/unix/zsyscall_linux_ppc.go | 10 - .../x/sys/unix/zsyscall_linux_ppc64.go | 10 - .../x/sys/unix/zsyscall_linux_ppc64le.go | 10 - .../x/sys/unix/zsyscall_linux_riscv64.go | 10 - .../x/sys/unix/zsyscall_linux_s390x.go | 10 - .../x/sys/unix/zsyscall_linux_sparc64.go | 10 - .../x/sys/unix/zsyscall_netbsd_386.go | 10 - .../x/sys/unix/zsyscall_netbsd_amd64.go | 10 - .../x/sys/unix/zsyscall_netbsd_arm.go | 10 - .../x/sys/unix/zsyscall_netbsd_arm64.go | 10 - .../x/sys/unix/zsyscall_openbsd_386.go | 14 -- .../x/sys/unix/zsyscall_openbsd_386.s | 5 - .../x/sys/unix/zsyscall_openbsd_amd64.go | 14 -- .../x/sys/unix/zsyscall_openbsd_amd64.s | 5 - .../x/sys/unix/zsyscall_openbsd_arm.go | 14 -- .../x/sys/unix/zsyscall_openbsd_arm.s | 5 - .../x/sys/unix/zsyscall_openbsd_arm64.go | 14 -- .../x/sys/unix/zsyscall_openbsd_arm64.s | 5 - .../x/sys/unix/zsyscall_openbsd_mips64.go | 14 -- .../x/sys/unix/zsyscall_openbsd_mips64.s | 5 - .../x/sys/unix/zsyscall_openbsd_ppc64.go | 14 -- .../x/sys/unix/zsyscall_openbsd_ppc64.s | 6 - .../x/sys/unix/zsyscall_openbsd_riscv64.go | 14 -- .../x/sys/unix/zsyscall_openbsd_riscv64.s | 5 - .../x/sys/unix/zsyscall_solaris_amd64.go | 17 +- .../x/sys/unix/zsyscall_zos_s390x.go | 4 +- .../x/sys/unix/ztypes_darwin_amd64.go | 11 ++ .../x/sys/unix/ztypes_darwin_arm64.go | 11 ++ .../golang.org/x/sys/windows/env_windows.go | 6 +- .../golang.org/x/sys/windows/exec_windows.go | 7 +- vendor/golang.org/x/sys/windows/service.go | 7 + .../golang.org/x/sys/windows/types_windows.go | 10 +- .../x/sys/windows/zsyscall_windows.go | 9 + vendor/modules.txt | 12 +- 148 files changed, 888 insertions(+), 1428 deletions(-) rename test/{placement/benchmark => benchmark/placement}/benchmark_test.go (99%) rename test/{ => integration}/integration-test.mk (79%) rename test/{registration-operator/integration => integration/operator}/clustermanager_hosted_test.go (99%) rename test/{registration-operator/integration => integration/operator}/clustermanager_test.go (99%) rename test/{registration-operator/integration => integration/operator}/doc.go (91%) rename test/{registration-operator/integration => integration/operator}/integration_suite_test.go (99%) rename test/{registration-operator/integration => integration/operator}/klusterlet_hosted_test.go (99%) rename test/{registration-operator/integration => integration/operator}/klusterlet_test.go (99%) rename test/{placement/integration => integration/placement}/assertion_test.go (99%) rename test/{placement/integration => integration/placement}/placement_test.go (99%) rename test/{placement/integration => integration/placement}/prioritizer_test.go (99%) rename test/{placement/integration => integration/placement}/suite_test.go (99%) rename test/{placement/integration => integration/placement}/toleration_test.go (99%) rename test/{registration/integration => integration/registration}/addon_lease_test.go (97%) rename test/{registration/integration => integration/registration}/addon_registration_test.go (99%) rename test/{registration/integration => integration/registration}/certificate_rotation_test.go (93%) rename test/{registration/integration => integration/registration}/default_managedclusterset_controller_test.go (98%) rename test/{registration/integration => integration/registration}/disaster_recovery_test.go (98%) rename test/{registration/integration => integration/registration}/doc.go (94%) rename test/{registration/integration => integration/registration}/global_managedclusterset_controller_test.go (99%) rename test/{registration/integration => integration/registration}/integration_suite_test.go (93%) rename test/{registration/integration => integration/registration}/managedcluster_deletion_test.go (99%) rename test/{registration/integration => integration/registration}/managedcluster_lease_test.go (94%) rename test/{registration/integration => integration/registration}/managedclusterset_test.go (99%) rename test/{registration/integration => integration/registration}/spokeagent_recovery_test.go (96%) rename test/{registration/integration => integration/registration}/spokeagent_restart_test.go (96%) rename test/{registration/integration => integration/registration}/spokecluster_autoapproval_test.go (94%) rename test/{registration/integration => integration/registration}/spokecluster_claim_test.go (98%) rename test/{registration/integration => integration/registration}/spokecluster_joining_test.go (95%) rename test/{registration/integration => integration/registration}/spokecluster_status_test.go (96%) rename test/{registration/integration => integration/registration}/taint_add_test.go (98%) rename test/{work => }/integration/util/assertion.go (81%) rename test/{registration/integration/util/util.go => integration/util/authentication.go} (75%) create mode 100644 test/integration/util/certificate.go create mode 100644 test/integration/util/kubeconfig.go create mode 100644 test/integration/util/managedcluster.go rename test/{placement/util/util.go => integration/util/recorder.go} (100%) create mode 100644 test/integration/util/structured.go rename test/{work => }/integration/util/unstructured.go (100%) rename test/{work/integration => integration/work}/deleteoption_test.go (99%) rename test/{work/integration => integration/work}/doc.go (88%) rename test/{work/integration => integration/work}/executor_test.go (99%) rename test/{work/integration => integration/work}/manifestworkreplicaset_test.go (99%) rename test/{work/integration => integration/work}/statusfeedback_test.go (99%) rename test/{work/integration => integration/work}/suite_test.go (97%) rename test/{work/integration => integration/work}/unmanaged_appliedwork_test.go (99%) rename test/{work/integration => integration/work}/updatestrategy_test.go (99%) rename test/{work/integration => integration/work}/work_test.go (97%) delete mode 100644 test/registration-operator/integration/util/assertion.go delete mode 100644 test/registration-operator/integration/util/util.go delete mode 100644 test/work/integration/report.xml delete mode 100644 test/work/integration/util/util.go create mode 100644 vendor/golang.org/x/sys/unix/ioctl_signed.go rename vendor/golang.org/x/sys/unix/{ioctl.go => ioctl_unsigned.go} (92%) diff --git a/Makefile b/Makefile index 78d7aab49..00226c561 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ include $(addprefix ./vendor/github.com/openshift/build-machinery-go/make/, \ ) # Include the integration setup makefile. -include ./test/integration-test.mk +include ./test/integration/integration-test.mk # Add packages to do unit test GO_TEST_PACKAGES :=./pkg/... diff --git a/go.mod b/go.mod index 2e13e0c5b..650e2a85d 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.2 golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 - golang.org/x/net v0.8.0 + golang.org/x/net v0.10.0 k8s.io/api v0.26.3 k8s.io/apiextensions-apiserver v0.26.3 k8s.io/apimachinery v0.26.3 @@ -99,12 +99,12 @@ require ( go.uber.org/zap v1.24.0 // indirect golang.org/x/crypto v0.1.0 // indirect golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect - golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.6.0 // indirect - golang.org/x/term v0.6.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/sync v0.2.0 // indirect + golang.org/x/sys v0.8.0 // indirect + golang.org/x/term v0.8.0 // indirect + golang.org/x/text v0.9.0 // indirect golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.7.0 // indirect + golang.org/x/tools v0.9.1 // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21 // indirect diff --git a/go.sum b/go.sum index c6eb8ebec..8aae3098e 100644 --- a/go.sum +++ b/go.sum @@ -720,6 +720,7 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -765,8 +766,8 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -788,8 +789,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -849,14 +850,14 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -867,8 +868,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -933,8 +934,8 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= -golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= +golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= +golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/pkg/version/version.go b/pkg/version/version.go index b58aae03a..55f38258a 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -2,8 +2,6 @@ package version import ( "k8s.io/apimachinery/pkg/version" - "k8s.io/component-base/metrics" - "k8s.io/component-base/metrics/legacyregistry" ) var ( @@ -32,16 +30,3 @@ func Get() version.Info { BuildDate: buildDate, } } - -func init() { - buildInfo := metrics.NewGaugeVec( - &metrics.GaugeOpts{ - Name: "open_cluster_management_build_info", - Help: "A metric with a constant '1' value labeled by major, minor, git commit & git version from which Open Cluster Management was built.", - }, - []string{"major", "minor", "gitCommit", "gitVersion"}, - ) - buildInfo.WithLabelValues(majorFromGit, minorFromGit, commitFromGit, versionFromGit).Set(1) - - legacyregistry.MustRegister(buildInfo) -} diff --git a/test/placement/benchmark/benchmark_test.go b/test/benchmark/placement/benchmark_test.go similarity index 99% rename from test/placement/benchmark/benchmark_test.go rename to test/benchmark/placement/benchmark_test.go index c5e044cf5..586bf5a90 100644 --- a/test/placement/benchmark/benchmark_test.go +++ b/test/benchmark/placement/benchmark_test.go @@ -1,8 +1,9 @@ -package benchmark +package placement import ( "context" "fmt" + "open-cluster-management.io/ocm/test/integration/util" "testing" "time" @@ -20,7 +21,6 @@ import ( controllers "open-cluster-management.io/ocm/pkg/placement/controllers" scheduling "open-cluster-management.io/ocm/pkg/placement/controllers/scheduling" - "open-cluster-management.io/ocm/test/placement/util" "sigs.k8s.io/controller-runtime/pkg/envtest" ) diff --git a/test/integration-test.mk b/test/integration/integration-test.mk similarity index 79% rename from test/integration-test.mk rename to test/integration/integration-test.mk index 938935a64..53ccc9546 100644 --- a/test/integration-test.mk +++ b/test/integration/integration-test.mk @@ -27,24 +27,24 @@ clean-integration-test: clean: clean-integration-test test-registration-integration: ensure-kubebuilder-tools - go test -c ./test/registration/integration -o ./registration-integration.test + go test -c ./test/integration/registration -o ./registration-integration.test ./registration-integration.test -ginkgo.slowSpecThreshold=15 -ginkgo.v -ginkgo.failFast .PHONY: test-registration-integration test-work-integration: ensure-kubebuilder-tools - go test -c ./test/work/integration -o ./work-integration.test + go test -c ./test/integration/work -o ./work-integration.test ./work-integration.test -ginkgo.slowSpecThreshold=15 -ginkgo.v -ginkgo.failFast .PHONY: test-work-integration test-placement-integration: ensure-kubebuilder-tools - go test -c ./test/placement/integration -o ./placement-integration.test + go test -c ./test/integration/placement -o ./placement-integration.test ./placement-integration.test -ginkgo.slowSpecThreshold=15 -ginkgo.v -ginkgo.failFast .PHONY: test-placement-integration test-registration-operator-integration: ensure-kubebuilder-tools - go test -c ./test/registration-operator/integration -o ./registration-operator-integration.test + go test -c ./test/integration/operator -o ./registration-operator-integration.test ./registration-operator-integration.test -ginkgo.slowSpecThreshold=15 -ginkgo.v -ginkgo.failFast .PHONY: test-registration-operator-integration -test-integration: ensure-kubebuilder-tools test-registration-operator-integration test-registration-integration test-placement-integration test-work-integration +test-integration: test-registration-operator-integration test-registration-integration test-placement-integration test-work-integration .PHONY: test-integration diff --git a/test/registration-operator/integration/clustermanager_hosted_test.go b/test/integration/operator/clustermanager_hosted_test.go similarity index 99% rename from test/registration-operator/integration/clustermanager_hosted_test.go rename to test/integration/operator/clustermanager_hosted_test.go index 09f9f1017..4f6aab5f5 100644 --- a/test/registration-operator/integration/clustermanager_hosted_test.go +++ b/test/integration/operator/clustermanager_hosted_test.go @@ -1,24 +1,23 @@ -package integration +package operator import ( "context" "fmt" + "open-cluster-management.io/ocm/test/integration/util" "time" "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" "github.com/openshift/library-go/pkg/operator/resource/resourceapply" - operatorapiv1 "open-cluster-management.io/api/operator/v1" - v1 "open-cluster-management.io/api/operator/v1" - "open-cluster-management.io/ocm/pkg/registration-operator/helpers" - "open-cluster-management.io/ocm/test/registration-operator/integration/util" - appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/util/cert" + operatorapiv1 "open-cluster-management.io/api/operator/v1" + v1 "open-cluster-management.io/api/operator/v1" + "open-cluster-management.io/ocm/pkg/registration-operator/helpers" ) func updateDeploymentStatus(kubeClient kubernetes.Interface, namespace, deploymentName string) { diff --git a/test/registration-operator/integration/clustermanager_test.go b/test/integration/operator/clustermanager_test.go similarity index 99% rename from test/registration-operator/integration/clustermanager_test.go rename to test/integration/operator/clustermanager_test.go index 86a01d341..a47817eb4 100644 --- a/test/registration-operator/integration/clustermanager_test.go +++ b/test/integration/operator/clustermanager_test.go @@ -1,8 +1,9 @@ -package integration +package operator import ( "context" "fmt" + "open-cluster-management.io/ocm/test/integration/util" "time" "github.com/onsi/ginkgo/v2" @@ -22,7 +23,6 @@ import ( "open-cluster-management.io/ocm/pkg/registration-operator/helpers" "open-cluster-management.io/ocm/pkg/registration-operator/operators/clustermanager" certrotation "open-cluster-management.io/ocm/pkg/registration-operator/operators/clustermanager/controllers/certrotationcontroller" - "open-cluster-management.io/ocm/test/registration-operator/integration/util" ) func startHubOperator(ctx context.Context, mode v1.InstallMode) { diff --git a/test/registration-operator/integration/doc.go b/test/integration/operator/doc.go similarity index 91% rename from test/registration-operator/integration/doc.go rename to test/integration/operator/doc.go index c44c8a07b..ac3f3dbc3 100644 --- a/test/registration-operator/integration/doc.go +++ b/test/integration/operator/doc.go @@ -1,4 +1,4 @@ // Package integration provides integration tests for open-cluster-management registration-operator, the test cases include // - deploy/update/remove the cluster manager // - deploy/update/remove the klusterlet -package integration +package operator diff --git a/test/registration-operator/integration/integration_suite_test.go b/test/integration/operator/integration_suite_test.go similarity index 99% rename from test/registration-operator/integration/integration_suite_test.go rename to test/integration/operator/integration_suite_test.go index b20e91b35..cd73b4836 100644 --- a/test/registration-operator/integration/integration_suite_test.go +++ b/test/integration/operator/integration_suite_test.go @@ -1,4 +1,4 @@ -package integration +package operator import ( "context" diff --git a/test/registration-operator/integration/klusterlet_hosted_test.go b/test/integration/operator/klusterlet_hosted_test.go similarity index 99% rename from test/registration-operator/integration/klusterlet_hosted_test.go rename to test/integration/operator/klusterlet_hosted_test.go index fc45cdf48..6a0746b85 100644 --- a/test/registration-operator/integration/klusterlet_hosted_test.go +++ b/test/integration/operator/klusterlet_hosted_test.go @@ -1,9 +1,8 @@ -package integration +package operator import ( "context" "fmt" - "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" @@ -11,7 +10,7 @@ import ( "k8s.io/apimachinery/pkg/util/rand" operatorapiv1 "open-cluster-management.io/api/operator/v1" "open-cluster-management.io/ocm/pkg/registration-operator/helpers" - "open-cluster-management.io/ocm/test/registration-operator/integration/util" + "open-cluster-management.io/ocm/test/integration/util" ) var _ = ginkgo.Describe("Klusterlet Hosted mode", func() { diff --git a/test/registration-operator/integration/klusterlet_test.go b/test/integration/operator/klusterlet_test.go similarity index 99% rename from test/registration-operator/integration/klusterlet_test.go rename to test/integration/operator/klusterlet_test.go index 8226086df..f494fbb39 100644 --- a/test/registration-operator/integration/klusterlet_test.go +++ b/test/integration/operator/klusterlet_test.go @@ -1,4 +1,4 @@ -package integration +package operator import ( "context" @@ -20,7 +20,7 @@ import ( operatorapiv1 "open-cluster-management.io/api/operator/v1" "open-cluster-management.io/ocm/pkg/registration-operator/helpers" "open-cluster-management.io/ocm/pkg/registration-operator/operators/klusterlet" - "open-cluster-management.io/ocm/test/registration-operator/integration/util" + "open-cluster-management.io/ocm/test/integration/util" ) func startKlusterletOperator(ctx context.Context) { diff --git a/test/placement/integration/assertion_test.go b/test/integration/placement/assertion_test.go similarity index 99% rename from test/placement/integration/assertion_test.go rename to test/integration/placement/assertion_test.go index e236b6cd2..557c2913e 100644 --- a/test/placement/integration/assertion_test.go +++ b/test/integration/placement/assertion_test.go @@ -1,8 +1,9 @@ -package integration +package placement import ( "context" "fmt" + "open-cluster-management.io/ocm/test/integration/util" "sort" "time" @@ -17,7 +18,6 @@ import ( clusterapiv1alpha1 "open-cluster-management.io/api/cluster/v1alpha1" clusterapiv1beta1 "open-cluster-management.io/api/cluster/v1beta1" clusterapiv1beta2 "open-cluster-management.io/api/cluster/v1beta2" - "open-cluster-management.io/ocm/test/placement/util" ) func assertPlacementDecisionCreated(placement *clusterapiv1beta1.Placement) { diff --git a/test/placement/integration/placement_test.go b/test/integration/placement/placement_test.go similarity index 99% rename from test/placement/integration/placement_test.go rename to test/integration/placement/placement_test.go index fe6f73d90..67d9bb22e 100644 --- a/test/placement/integration/placement_test.go +++ b/test/integration/placement/placement_test.go @@ -1,8 +1,9 @@ -package integration +package placement import ( "context" "fmt" + "open-cluster-management.io/ocm/test/integration/util" "time" "github.com/onsi/ginkgo/v2" @@ -15,7 +16,6 @@ import ( clusterapiv1beta1 "open-cluster-management.io/api/cluster/v1beta1" controllers "open-cluster-management.io/ocm/pkg/placement/controllers" "open-cluster-management.io/ocm/pkg/placement/controllers/scheduling" - "open-cluster-management.io/ocm/test/placement/util" ) const ( diff --git a/test/placement/integration/prioritizer_test.go b/test/integration/placement/prioritizer_test.go similarity index 99% rename from test/placement/integration/prioritizer_test.go rename to test/integration/placement/prioritizer_test.go index 76229e385..2635e344f 100644 --- a/test/placement/integration/prioritizer_test.go +++ b/test/integration/placement/prioritizer_test.go @@ -1,8 +1,9 @@ -package integration +package placement import ( "context" "fmt" + "open-cluster-management.io/ocm/test/integration/util" "time" "github.com/onsi/ginkgo/v2" @@ -14,7 +15,6 @@ import ( clusterapiv1beta1 "open-cluster-management.io/api/cluster/v1beta1" controllers "open-cluster-management.io/ocm/pkg/placement/controllers" "open-cluster-management.io/ocm/pkg/placement/controllers/scheduling" - "open-cluster-management.io/ocm/test/placement/util" ) var _ = ginkgo.Describe("Prioritizers", func() { diff --git a/test/placement/integration/suite_test.go b/test/integration/placement/suite_test.go similarity index 99% rename from test/placement/integration/suite_test.go rename to test/integration/placement/suite_test.go index 587ce57b8..910199177 100644 --- a/test/placement/integration/suite_test.go +++ b/test/integration/placement/suite_test.go @@ -1,4 +1,4 @@ -package integration +package placement import ( "testing" diff --git a/test/placement/integration/toleration_test.go b/test/integration/placement/toleration_test.go similarity index 99% rename from test/placement/integration/toleration_test.go rename to test/integration/placement/toleration_test.go index d7be6d160..9cc3335ed 100644 --- a/test/placement/integration/toleration_test.go +++ b/test/integration/placement/toleration_test.go @@ -1,8 +1,9 @@ -package integration +package placement import ( "context" "fmt" + "open-cluster-management.io/ocm/test/integration/util" "time" "github.com/onsi/ginkgo/v2" @@ -15,7 +16,6 @@ import ( clusterapiv1beta1 "open-cluster-management.io/api/cluster/v1beta1" controllers "open-cluster-management.io/ocm/pkg/placement/controllers" "open-cluster-management.io/ocm/pkg/placement/controllers/scheduling" - "open-cluster-management.io/ocm/test/placement/util" ) var _ = ginkgo.Describe("TaintToleration", func() { diff --git a/test/registration/integration/addon_lease_test.go b/test/integration/registration/addon_lease_test.go similarity index 97% rename from test/registration/integration/addon_lease_test.go rename to test/integration/registration/addon_lease_test.go index 8efa6a21b..1d56d0bb3 100644 --- a/test/registration/integration/addon_lease_test.go +++ b/test/integration/registration/addon_lease_test.go @@ -1,25 +1,24 @@ -package integration_test +package registration_test import ( "context" "fmt" + "open-cluster-management.io/ocm/test/integration/util" "path" "time" "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" - addonv1alpha1 "open-cluster-management.io/api/addon/v1alpha1" - clusterv1 "open-cluster-management.io/api/cluster/v1" - "open-cluster-management.io/ocm/pkg/features" - "open-cluster-management.io/ocm/pkg/registration/spoke" - "open-cluster-management.io/ocm/test/registration/integration/util" - coordv1 "k8s.io/api/coordination/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/rand" + addonv1alpha1 "open-cluster-management.io/api/addon/v1alpha1" + clusterv1 "open-cluster-management.io/api/cluster/v1" + "open-cluster-management.io/ocm/pkg/features" + "open-cluster-management.io/ocm/pkg/registration/spoke" ) var _ = ginkgo.Describe("Addon Lease Resync", func() { @@ -175,7 +174,7 @@ var _ = ginkgo.Describe("Addon Lease Resync", func() { ClusterHealthCheckPeriod: 1 * time.Minute, } - cancel = util.RunAgent("addontest", agentOptions, spokeCfg) + cancel = runAgent("addontest", agentOptions, spokeCfg) }) ginkgo.AfterEach(func() { diff --git a/test/registration/integration/addon_registration_test.go b/test/integration/registration/addon_registration_test.go similarity index 99% rename from test/registration/integration/addon_registration_test.go rename to test/integration/registration/addon_registration_test.go index bedd49762..7aac30cd6 100644 --- a/test/registration/integration/addon_registration_test.go +++ b/test/integration/registration/addon_registration_test.go @@ -1,8 +1,9 @@ -package integration_test +package registration_test import ( "context" "fmt" + "open-cluster-management.io/ocm/test/integration/util" "path" "reflect" "strings" @@ -22,7 +23,6 @@ import ( "open-cluster-management.io/ocm/pkg/features" "open-cluster-management.io/ocm/pkg/registration/clientcert" "open-cluster-management.io/ocm/pkg/registration/spoke" - "open-cluster-management.io/ocm/test/registration/integration/util" ) var _ = ginkgo.Describe("Addon Registration", func() { @@ -49,7 +49,7 @@ var _ = ginkgo.Describe("Addon Registration", func() { } // run registration agent - cancel = util.RunAgent("addontest", agentOptions, spokeCfg) + cancel = runAgent("addontest", agentOptions, spokeCfg) }) ginkgo.AfterEach( diff --git a/test/registration/integration/certificate_rotation_test.go b/test/integration/registration/certificate_rotation_test.go similarity index 93% rename from test/registration/integration/certificate_rotation_test.go rename to test/integration/registration/certificate_rotation_test.go index dbddb7b52..d8bd9e580 100644 --- a/test/registration/integration/certificate_rotation_test.go +++ b/test/integration/registration/certificate_rotation_test.go @@ -1,6 +1,7 @@ -package integration_test +package registration_test import ( + "open-cluster-management.io/ocm/test/integration/util" "path" "time" @@ -8,7 +9,6 @@ import ( "github.com/onsi/gomega" "open-cluster-management.io/ocm/pkg/registration/spoke" - "open-cluster-management.io/ocm/test/registration/integration/util" ) var _ = ginkgo.Describe("Certificate Rotation", func() { @@ -28,7 +28,7 @@ var _ = ginkgo.Describe("Certificate Rotation", func() { } // run registration agent - cancel := util.RunAgent("rotationtest", agentOptions, spokeCfg) + cancel := runAgent("rotationtest", agentOptions, spokeCfg) defer cancel() // after bootstrap the spokecluster and csr should be created diff --git a/test/registration/integration/default_managedclusterset_controller_test.go b/test/integration/registration/default_managedclusterset_controller_test.go similarity index 98% rename from test/registration/integration/default_managedclusterset_controller_test.go rename to test/integration/registration/default_managedclusterset_controller_test.go index ca8ab710e..aa125e0fa 100644 --- a/test/registration/integration/default_managedclusterset_controller_test.go +++ b/test/integration/registration/default_managedclusterset_controller_test.go @@ -1,4 +1,4 @@ -package integration_test +package registration_test import ( "context" diff --git a/test/registration/integration/disaster_recovery_test.go b/test/integration/registration/disaster_recovery_test.go similarity index 98% rename from test/registration/integration/disaster_recovery_test.go rename to test/integration/registration/disaster_recovery_test.go index 167b97c5f..413febb74 100644 --- a/test/registration/integration/disaster_recovery_test.go +++ b/test/integration/registration/disaster_recovery_test.go @@ -1,8 +1,9 @@ -package integration_test +package registration_test import ( "context" "fmt" + "open-cluster-management.io/ocm/test/integration/util" "os" "path" "time" @@ -18,6 +19,7 @@ import ( "k8s.io/client-go/kubernetes/scheme" "sigs.k8s.io/controller-runtime/pkg/envtest" + "github.com/openshift/library-go/pkg/controller/controllercmd" addonv1alpha1 "open-cluster-management.io/api/addon/v1alpha1" addonclientset "open-cluster-management.io/api/client/addon/clientset/versioned" clusterclientset "open-cluster-management.io/api/client/cluster/clientset/versioned" @@ -26,9 +28,6 @@ import ( "open-cluster-management.io/ocm/pkg/registration/clientcert" "open-cluster-management.io/ocm/pkg/registration/hub" "open-cluster-management.io/ocm/pkg/registration/spoke" - "open-cluster-management.io/ocm/test/registration/integration/util" - - "github.com/openshift/library-go/pkg/controller/controllercmd" ) var _ = ginkgo.Describe("Disaster Recovery", func() { @@ -98,7 +97,7 @@ var _ = ginkgo.Describe("Disaster Recovery", func() { HubKubeconfigDir: hubKubeconfigDir, ClusterHealthCheckPeriod: 1 * time.Minute, } - return util.RunAgent("addontest", agentOptions, spokeCfg) + return runAgent("addontest", agentOptions, spokeCfg) } assertSuccessClusterBootstrap := func(testNamespace, managedClusterName, hubKubeconfigSecret string, hubKubeClient, spokeKubeClient kubernetes.Interface, hubClusterClient clusterclientset.Interface, auth *util.TestAuthn) { diff --git a/test/registration/integration/doc.go b/test/integration/registration/doc.go similarity index 94% rename from test/registration/integration/doc.go rename to test/integration/registration/doc.go index 29c1086df..6ef8251d9 100644 --- a/test/registration/integration/doc.go +++ b/test/integration/registration/doc.go @@ -4,4 +4,4 @@ // - registration agent rotate its certificate after its certificate is expired // - registration agent recovery from invalid bootstrap kubeconfig // - registration agent recovery from invalid hub kubeconfig -package integration +package registration diff --git a/test/registration/integration/global_managedclusterset_controller_test.go b/test/integration/registration/global_managedclusterset_controller_test.go similarity index 99% rename from test/registration/integration/global_managedclusterset_controller_test.go rename to test/integration/registration/global_managedclusterset_controller_test.go index 8b36e58a4..1bb8cf6d2 100644 --- a/test/registration/integration/global_managedclusterset_controller_test.go +++ b/test/integration/registration/global_managedclusterset_controller_test.go @@ -1,4 +1,4 @@ -package integration_test +package registration_test import ( "context" diff --git a/test/registration/integration/integration_suite_test.go b/test/integration/registration/integration_suite_test.go similarity index 93% rename from test/registration/integration/integration_suite_test.go rename to test/integration/registration/integration_suite_test.go index 54c6d2126..0a7d3f098 100644 --- a/test/registration/integration/integration_suite_test.go +++ b/test/integration/registration/integration_suite_test.go @@ -1,8 +1,9 @@ -package integration_test +package registration_test import ( "context" "fmt" + "open-cluster-management.io/ocm/test/integration/util" "os" "path" "testing" @@ -28,8 +29,6 @@ import ( "open-cluster-management.io/ocm/pkg/registration/spoke" "open-cluster-management.io/ocm/pkg/registration/spoke/addon" "open-cluster-management.io/ocm/pkg/registration/spoke/managedcluster" - "open-cluster-management.io/ocm/test/registration/integration/util" - "sigs.k8s.io/controller-runtime/pkg/envtest" logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" @@ -70,6 +69,21 @@ var CRDPaths = []string{ "./vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml", } +func runAgent(name string, opt spoke.SpokeAgentOptions, cfg *rest.Config) context.CancelFunc { + ctx, cancel := context.WithCancel(context.Background()) + go func() { + err := opt.RunSpokeAgent(ctx, &controllercmd.ControllerContext{ + KubeConfig: cfg, + EventRecorder: util.NewIntegrationTestEventRecorder(name), + }) + if err != nil { + return + } + }() + + return cancel +} + func TestIntegration(t *testing.T) { gomega.RegisterFailHandler(ginkgo.Fail) ginkgo.RunSpecs(t, "Integration Suite") diff --git a/test/registration/integration/managedcluster_deletion_test.go b/test/integration/registration/managedcluster_deletion_test.go similarity index 99% rename from test/registration/integration/managedcluster_deletion_test.go rename to test/integration/registration/managedcluster_deletion_test.go index 74551c1c6..111084f2c 100644 --- a/test/registration/integration/managedcluster_deletion_test.go +++ b/test/integration/registration/managedcluster_deletion_test.go @@ -1,4 +1,4 @@ -package integration_test +package registration_test import ( "context" diff --git a/test/registration/integration/managedcluster_lease_test.go b/test/integration/registration/managedcluster_lease_test.go similarity index 94% rename from test/registration/integration/managedcluster_lease_test.go rename to test/integration/registration/managedcluster_lease_test.go index f87ddfb54..44cc2404f 100644 --- a/test/registration/integration/managedcluster_lease_test.go +++ b/test/integration/registration/managedcluster_lease_test.go @@ -1,22 +1,21 @@ -package integration_test +package registration_test import ( "context" "fmt" + "open-cluster-management.io/ocm/test/integration/util" "path" "time" "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" - clusterv1 "open-cluster-management.io/api/cluster/v1" - "open-cluster-management.io/ocm/pkg/registration/spoke" - "open-cluster-management.io/ocm/test/registration/integration/util" - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/rand" + clusterv1 "open-cluster-management.io/api/cluster/v1" + "open-cluster-management.io/ocm/pkg/registration/spoke" ) var _ = ginkgo.Describe("Cluster Lease Update", func() { @@ -39,7 +38,7 @@ var _ = ginkgo.Describe("Cluster Lease Update", func() { HubKubeconfigDir: hubKubeconfigDir, ClusterHealthCheckPeriod: 1 * time.Minute, } - cancel := util.RunAgent("cluster-leasetest", agentOptions, spokeCfg) + cancel := runAgent("cluster-leasetest", agentOptions, spokeCfg) defer cancel() bootstrapManagedCluster(managedClusterName, hubKubeconfigSecret, util.TestLeaseDurationSeconds) @@ -57,7 +56,7 @@ var _ = ginkgo.Describe("Cluster Lease Update", func() { HubKubeconfigDir: hubKubeconfigDir, ClusterHealthCheckPeriod: 1 * time.Minute, } - stop := util.RunAgent("cluster-availabletest", agentOptions, spokeCfg) + stop := runAgent("cluster-availabletest", agentOptions, spokeCfg) bootstrapManagedCluster(managedClusterName, hubKubeconfigSecret, util.TestLeaseDurationSeconds) assertAvailableCondition(managedClusterName, metav1.ConditionTrue, 0) @@ -76,7 +75,7 @@ var _ = ginkgo.Describe("Cluster Lease Update", func() { HubKubeconfigDir: hubKubeconfigDir, ClusterHealthCheckPeriod: 1 * time.Minute, } - stop = util.RunAgent("cluster-availabletest", agentOptions, spokeCfg) + stop = runAgent("cluster-availabletest", agentOptions, spokeCfg) defer stop() // after one grace period, make sure the managed cluster available condition is recovered @@ -93,7 +92,7 @@ var _ = ginkgo.Describe("Cluster Lease Update", func() { HubKubeconfigDir: hubKubeconfigDir, ClusterHealthCheckPeriod: 1 * time.Minute, } - cancel := util.RunAgent("cluster-leasetest", agentOptions, spokeCfg) + cancel := runAgent("cluster-leasetest", agentOptions, spokeCfg) defer cancel() bootstrapManagedCluster(managedClusterName, hubKubeconfigSecret, util.TestLeaseDurationSeconds) @@ -143,7 +142,7 @@ var _ = ginkgo.Describe("Cluster Lease Update", func() { HubKubeconfigDir: hubKubeconfigDir, ClusterHealthCheckPeriod: 1 * time.Minute, } - stop := util.RunAgent("cluster-leasetest", agentOptions, spokeCfg) + stop := runAgent("cluster-leasetest", agentOptions, spokeCfg) bootstrapManagedCluster(managedClusterName, hubKubeconfigSecret, 60) assertAvailableCondition(managedClusterName, metav1.ConditionTrue, 0) diff --git a/test/registration/integration/managedclusterset_test.go b/test/integration/registration/managedclusterset_test.go similarity index 99% rename from test/registration/integration/managedclusterset_test.go rename to test/integration/registration/managedclusterset_test.go index 8c659b14f..283c0d809 100644 --- a/test/registration/integration/managedclusterset_test.go +++ b/test/integration/registration/managedclusterset_test.go @@ -1,4 +1,4 @@ -package integration_test +package registration_test import ( "context" diff --git a/test/registration/integration/spokeagent_recovery_test.go b/test/integration/registration/spokeagent_recovery_test.go similarity index 96% rename from test/registration/integration/spokeagent_recovery_test.go rename to test/integration/registration/spokeagent_recovery_test.go index 9c4596212..d71ee4769 100644 --- a/test/registration/integration/spokeagent_recovery_test.go +++ b/test/integration/registration/spokeagent_recovery_test.go @@ -1,7 +1,8 @@ -package integration_test +package registration_test import ( "fmt" + "open-cluster-management.io/ocm/test/integration/util" "path" "reflect" "time" @@ -9,13 +10,11 @@ import ( "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" - clusterv1 "open-cluster-management.io/api/cluster/v1" - "open-cluster-management.io/ocm/pkg/registration/spoke" - "open-cluster-management.io/ocm/test/registration/integration/util" - corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" + clusterv1 "open-cluster-management.io/api/cluster/v1" + "open-cluster-management.io/ocm/pkg/registration/spoke" ) var _ = ginkgo.Describe("Agent Recovery", func() { @@ -42,7 +41,7 @@ var _ = ginkgo.Describe("Agent Recovery", func() { ClusterHealthCheckPeriod: 1 * time.Minute, } - cancel := util.RunAgent("bootstrap-recoverytest", agentOptions, spokeCfg) + cancel := runAgent("bootstrap-recoverytest", agentOptions, spokeCfg) defer cancel() // the managedcluster should not be created @@ -129,7 +128,7 @@ var _ = ginkgo.Describe("Agent Recovery", func() { ClusterHealthCheckPeriod: 1 * time.Minute, } - cancel := util.RunAgent("hubkubeconfig-recoverytest", agentOptions, spokeCfg) + cancel := runAgent("hubkubeconfig-recoverytest", agentOptions, spokeCfg) defer cancel() // after bootstrap the spokecluster and csr should be created diff --git a/test/registration/integration/spokeagent_restart_test.go b/test/integration/registration/spokeagent_restart_test.go similarity index 96% rename from test/registration/integration/spokeagent_restart_test.go rename to test/integration/registration/spokeagent_restart_test.go index cb69501e4..a452249d6 100644 --- a/test/registration/integration/spokeagent_restart_test.go +++ b/test/integration/registration/spokeagent_restart_test.go @@ -1,20 +1,19 @@ -package integration_test +package registration_test import ( "context" "fmt" + "open-cluster-management.io/ocm/test/integration/util" "path" "time" "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" - clusterv1 "open-cluster-management.io/api/cluster/v1" - "open-cluster-management.io/ocm/pkg/registration/spoke" - "open-cluster-management.io/ocm/test/registration/integration/util" - "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "open-cluster-management.io/api/cluster/v1" + "open-cluster-management.io/ocm/pkg/registration/spoke" ) var _ = ginkgo.Describe("Agent Restart", func() { @@ -41,7 +40,7 @@ var _ = ginkgo.Describe("Agent Restart", func() { ClusterHealthCheckPeriod: 1 * time.Minute, } - stopAgent := util.RunAgent("restart-test", agentOptions, spokeCfg) + stopAgent := runAgent("restart-test", agentOptions, spokeCfg) ginkgo.By("Check existence of csr and ManagedCluster") // the csr should be created @@ -116,7 +115,7 @@ var _ = ginkgo.Describe("Agent Restart", func() { HubKubeconfigDir: hubKubeconfigDir, ClusterHealthCheckPeriod: 1 * time.Minute, } - stopAgent = util.RunAgent("restart-test", agentOptions, spokeCfg) + stopAgent = runAgent("restart-test", agentOptions, spokeCfg) defer stopAgent() ginkgo.By("Check if ManagedCluster joins the hub") @@ -169,7 +168,7 @@ var _ = ginkgo.Describe("Agent Restart", func() { ClusterHealthCheckPeriod: 1 * time.Minute, } - stopAgent := util.RunAgent("restart-test", agentOptions, spokeCfg) + stopAgent := runAgent("restart-test", agentOptions, spokeCfg) ginkgo.By("Check existence of csr and ManagedCluster") // the csr should be created @@ -230,7 +229,7 @@ var _ = ginkgo.Describe("Agent Restart", func() { HubKubeconfigDir: hubKubeconfigDir, ClusterHealthCheckPeriod: 1 * time.Minute, } - stopAgent = util.RunAgent("restart-test", agentOptions, spokeCfg) + stopAgent = runAgent("restart-test", agentOptions, spokeCfg) defer stopAgent() ginkgo.By("Check the existence of csr and the new ManagedCluster") diff --git a/test/registration/integration/spokecluster_autoapproval_test.go b/test/integration/registration/spokecluster_autoapproval_test.go similarity index 94% rename from test/registration/integration/spokecluster_autoapproval_test.go rename to test/integration/registration/spokecluster_autoapproval_test.go index fdbe72b50..f4334b681 100644 --- a/test/registration/integration/spokecluster_autoapproval_test.go +++ b/test/integration/registration/spokecluster_autoapproval_test.go @@ -1,7 +1,8 @@ -package integration_test +package registration_test import ( "fmt" + "open-cluster-management.io/ocm/test/integration/util" "path" "time" @@ -11,7 +12,6 @@ import ( "k8s.io/apimachinery/pkg/api/meta" clusterv1 "open-cluster-management.io/api/cluster/v1" "open-cluster-management.io/ocm/pkg/registration/spoke" - "open-cluster-management.io/ocm/test/registration/integration/util" ) var _ = ginkgo.Describe("Cluster Auto Approval", func() { @@ -35,7 +35,7 @@ var _ = ginkgo.Describe("Cluster Auto Approval", func() { } // run registration agent - cancel := util.RunAgent("autoapprovaltest", agentOptions, spokeCfg) + cancel := runAgent("autoapprovaltest", agentOptions, spokeCfg) defer cancel() gomega.Eventually(func() error { diff --git a/test/registration/integration/spokecluster_claim_test.go b/test/integration/registration/spokecluster_claim_test.go similarity index 98% rename from test/registration/integration/spokecluster_claim_test.go rename to test/integration/registration/spokecluster_claim_test.go index 2da6e0f21..8cd7fdf8a 100644 --- a/test/registration/integration/spokecluster_claim_test.go +++ b/test/integration/registration/spokecluster_claim_test.go @@ -1,8 +1,9 @@ -package integration_test +package registration_test import ( "context" "fmt" + "open-cluster-management.io/ocm/test/integration/util" "path" "reflect" "time" @@ -16,7 +17,6 @@ import ( clusterv1 "open-cluster-management.io/api/cluster/v1" clusterv1alpha1 "open-cluster-management.io/api/cluster/v1alpha1" "open-cluster-management.io/ocm/pkg/registration/spoke" - "open-cluster-management.io/ocm/test/registration/integration/util" ) var _ = ginkgo.Describe("Cluster Claim", func() { @@ -55,7 +55,7 @@ var _ = ginkgo.Describe("Cluster Claim", func() { ClusterHealthCheckPeriod: 1 * time.Minute, MaxCustomClusterClaims: maxCustomClusterClaims, } - cancel = util.RunAgent("claimtest", agentOptions, spokeCfg) + cancel = runAgent("claimtest", agentOptions, spokeCfg) }) ginkgo.AfterEach( diff --git a/test/registration/integration/spokecluster_joining_test.go b/test/integration/registration/spokecluster_joining_test.go similarity index 95% rename from test/registration/integration/spokecluster_joining_test.go rename to test/integration/registration/spokecluster_joining_test.go index 07fe3ba72..b70077e11 100644 --- a/test/registration/integration/spokecluster_joining_test.go +++ b/test/integration/registration/spokecluster_joining_test.go @@ -1,7 +1,8 @@ -package integration_test +package registration_test import ( "fmt" + "open-cluster-management.io/ocm/test/integration/util" "path" "time" @@ -11,7 +12,6 @@ import ( clusterv1 "open-cluster-management.io/api/cluster/v1" "open-cluster-management.io/ocm/pkg/registration/spoke" - "open-cluster-management.io/ocm/test/registration/integration/util" ) var _ = ginkgo.Describe("Joining Process", func() { @@ -31,7 +31,7 @@ var _ = ginkgo.Describe("Joining Process", func() { ClusterHealthCheckPeriod: 1 * time.Minute, } - cancel := util.RunAgent("joiningtest", agentOptions, spokeCfg) + cancel := runAgent("joiningtest", agentOptions, spokeCfg) defer cancel() // the spoke cluster and csr should be created after bootstrap diff --git a/test/registration/integration/spokecluster_status_test.go b/test/integration/registration/spokecluster_status_test.go similarity index 96% rename from test/registration/integration/spokecluster_status_test.go rename to test/integration/registration/spokecluster_status_test.go index d0ff6b9b5..d0ca4b0e8 100644 --- a/test/registration/integration/spokecluster_status_test.go +++ b/test/integration/registration/spokecluster_status_test.go @@ -1,7 +1,8 @@ -package integration_test +package registration_test import ( "fmt" + "open-cluster-management.io/ocm/test/integration/util" "path" "time" @@ -11,7 +12,6 @@ import ( clusterv1 "open-cluster-management.io/api/cluster/v1" "open-cluster-management.io/ocm/pkg/registration/spoke" - "open-cluster-management.io/ocm/test/registration/integration/util" ) var _ = ginkgo.Describe("Collecting Node Resource", func() { @@ -37,7 +37,7 @@ var _ = ginkgo.Describe("Collecting Node Resource", func() { ClusterHealthCheckPeriod: 1 * time.Minute, } - cancel := util.RunAgent("resorucetest", agentOptions, spokeCfg) + cancel := runAgent("resorucetest", agentOptions, spokeCfg) defer cancel() // the spoke cluster and csr should be created after bootstrap diff --git a/test/registration/integration/taint_add_test.go b/test/integration/registration/taint_add_test.go similarity index 98% rename from test/registration/integration/taint_add_test.go rename to test/integration/registration/taint_add_test.go index 3d22a7eaf..7c6683f6e 100644 --- a/test/registration/integration/taint_add_test.go +++ b/test/integration/registration/taint_add_test.go @@ -1,4 +1,4 @@ -package integration_test +package registration_test import ( "context" @@ -13,7 +13,7 @@ import ( "open-cluster-management.io/ocm/pkg/registration/helpers" "open-cluster-management.io/ocm/pkg/registration/hub/taint" "open-cluster-management.io/ocm/pkg/registration/spoke" - "open-cluster-management.io/ocm/test/registration/integration/util" + "open-cluster-management.io/ocm/test/integration/util" "path" "time" ) diff --git a/test/work/integration/util/assertion.go b/test/integration/util/assertion.go similarity index 81% rename from test/work/integration/util/assertion.go rename to test/integration/util/assertion.go index 9bea4fd89..a883db56e 100644 --- a/test/work/integration/util/assertion.go +++ b/test/integration/util/assertion.go @@ -3,23 +3,63 @@ package util import ( "context" "fmt" + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/dynamic" + "k8s.io/client-go/kubernetes" + workclientset "open-cluster-management.io/api/client/work/clientset/versioned" + workapiv1 "open-cluster-management.io/api/work/v1" "reflect" "sort" "github.com/onsi/gomega" - corev1 "k8s.io/api/core/v1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/client-go/dynamic" - "k8s.io/client-go/kubernetes" - workclientset "open-cluster-management.io/api/client/work/clientset/versioned" - workapiv1 "open-cluster-management.io/api/work/v1" + operatorclientset "open-cluster-management.io/api/client/operator/clientset/versioned" ) +const ( + eventuallyTimeout = 60 // seconds + eventuallyInterval = 1 // seconds +) + +func AssertKlusterletCondition( + name string, operatorClient operatorclientset.Interface, expectedType, expectedReason string, expectedWorkStatus metav1.ConditionStatus) { + gomega.Eventually(func() error { + klusterlet, err := operatorClient.OperatorV1().Klusterlets().Get(context.Background(), name, metav1.GetOptions{}) + if err != nil { + return err + } + + // check work status condition + if !HasCondition(klusterlet.Status.Conditions, expectedType, expectedReason, expectedWorkStatus) { + return fmt.Errorf("expect have type %s with reason %s and status %s, but got %v", + expectedType, expectedReason, expectedWorkStatus, klusterlet.Status.Conditions) + } + return nil + }, eventuallyTimeout, eventuallyInterval).ShouldNot(gomega.HaveOccurred()) +} + +func AssertClusterManagerCondition( + name string, operatorClient operatorclientset.Interface, expectedType, expectedReason string, expectedWorkStatus metav1.ConditionStatus) { + gomega.Eventually(func() error { + clusterManager, err := operatorClient.OperatorV1().ClusterManagers().Get(context.Background(), name, metav1.GetOptions{}) + if err != nil { + return err + } + + // check work status condition + if !HasCondition(clusterManager.Status.Conditions, expectedType, expectedReason, expectedWorkStatus) { + return fmt.Errorf("expect have type %s with reason %s and status %s, but got %v", + expectedType, expectedReason, expectedWorkStatus, clusterManager.Status.Conditions) + } + return nil + }, eventuallyTimeout, eventuallyInterval).ShouldNot(gomega.HaveOccurred()) +} + func AssertWorkCondition(namespace, name string, workClient workclientset.Interface, expectedType string, expectedWorkStatus metav1.ConditionStatus, expectedManifestStatuses []metav1.ConditionStatus, eventuallyTimeout, eventuallyInterval int) { gomega.Eventually(func() error { @@ -249,3 +289,22 @@ func AssertAppliedResources(hubHash, workName string, gvrs []schema.GroupVersion return nil }, eventuallyTimeout, eventuallyInterval).ShouldNot(gomega.HaveOccurred()) } + +func HaveManifestCondition(conditions []workapiv1.ManifestCondition, expectedType string, expectedStatuses []metav1.ConditionStatus) bool { + if len(conditions) != len(expectedStatuses) { + return false + } + + for index, condition := range conditions { + expectedStatus := expectedStatuses[index] + if expectedStatus == "" { + continue + } + + if ok := meta.IsStatusConditionPresentAndEqual(condition.Conditions, expectedType, expectedStatus); !ok { + return false + } + } + + return true +} diff --git a/test/registration/integration/util/util.go b/test/integration/util/authentication.go similarity index 75% rename from test/registration/integration/util/util.go rename to test/integration/util/authentication.go index 5a79e3451..2e6417234 100644 --- a/test/registration/integration/util/util.go +++ b/test/integration/util/authentication.go @@ -16,18 +16,9 @@ import ( "path" "time" - "github.com/onsi/ginkgo/v2" - - clusterclientset "open-cluster-management.io/api/client/cluster/clientset/versioned" - clusterv1 "open-cluster-management.io/api/cluster/v1" - - "github.com/openshift/library-go/pkg/controller/controllercmd" - "github.com/openshift/library-go/pkg/operator/events" - certificates "k8s.io/api/certificates/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" @@ -35,8 +26,6 @@ import ( clientcmdapi "k8s.io/client-go/tools/clientcmd/api" certutil "k8s.io/client-go/util/cert" "k8s.io/client-go/util/keyutil" - "k8s.io/client-go/util/retry" - "open-cluster-management.io/ocm/pkg/registration/spoke" "sigs.k8s.io/controller-runtime/pkg/envtest" ) @@ -56,7 +45,12 @@ var ( DefaultTestAuthn = NewTestAuthn(caFile, caKeyFile) ) -func createKubeConfig(context string, securePort string, serverCertFile, certFile, keyFile string) (*clientcmdapi.Config, error) { +type TestAuthn struct { + caFile string + caKeyFile string +} + +func createKubeConfigByClientCert(context string, securePort string, serverCertFile, certFile, keyFile string) (*clientcmdapi.Config, error) { caData, err := ioutil.ReadFile(serverCertFile) if err != nil { return nil, err @@ -80,11 +74,6 @@ func createKubeConfig(context string, securePort string, serverCertFile, certFil return config, nil } -type TestAuthn struct { - caFile string - caKeyFile string -} - func NewTestAuthn(caFile, caKeyFile string) *TestAuthn { return &TestAuthn{ caFile: caFile, @@ -200,7 +189,7 @@ func (t *TestAuthn) CreateBootstrapKubeConfig(configFileName, serverCertFile, se return err } - config, err := createKubeConfig(configFileName, securePort, serverCertFile, path.Join(configDir, "bootstrap.crt"), path.Join(configDir, "bootstrap.key")) + config, err := createKubeConfigByClientCert(configFileName, securePort, serverCertFile, path.Join(configDir, "bootstrap.crt"), path.Join(configDir, "bootstrap.key")) if err != nil { return err } @@ -509,130 +498,3 @@ func (t *TestAuthn) FillCertificateToApprovedCSR(kubeClient kubernetes.Interface return nil } - -func GetManagedCluster(clusterClient clusterclientset.Interface, spokeClusterName string) (*clusterv1.ManagedCluster, error) { - spokeCluster, err := clusterClient.ClusterV1().ManagedClusters().Get(context.TODO(), spokeClusterName, metav1.GetOptions{}) - if err != nil { - return nil, err - } - return spokeCluster, nil -} - -func AcceptManagedCluster(clusterClient clusterclientset.Interface, spokeClusterName string) error { - return AcceptManagedClusterWithLeaseDuration(clusterClient, spokeClusterName, 60) -} - -func AcceptManagedClusterWithLeaseDuration(clusterClient clusterclientset.Interface, spokeClusterName string, leaseDuration int32) error { - return retry.RetryOnConflict(retry.DefaultBackoff, func() error { - spokeCluster, err := GetManagedCluster(clusterClient, spokeClusterName) - if err != nil { - return err - } - spokeCluster.Spec.HubAcceptsClient = true - spokeCluster.Spec.LeaseDurationSeconds = leaseDuration - _, err = clusterClient.ClusterV1().ManagedClusters().Update(context.TODO(), spokeCluster, metav1.UpdateOptions{}) - return err - }) -} - -func CreateNode(kubeClient kubernetes.Interface, name string, capacity, allocatable corev1.ResourceList) error { - node := &corev1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - }, - Status: corev1.NodeStatus{ - Capacity: capacity, - Allocatable: allocatable, - }, - } - _, err := kubeClient.CoreV1().Nodes().Create(context.TODO(), node, metav1.CreateOptions{}) - return err -} - -func CordonNode(kubeClient kubernetes.Interface, name string) error { - node, err := kubeClient.CoreV1().Nodes().Get(context.TODO(), name, metav1.GetOptions{}) - if err != nil { - return err - } - - node = node.DeepCopy() - node.Spec.Unschedulable = true - _, err = kubeClient.CoreV1().Nodes().Update(context.TODO(), node, metav1.UpdateOptions{}) - return err -} - -func NewResourceList(cpu, mem int) corev1.ResourceList { - return corev1.ResourceList{ - corev1.ResourceCPU: *resource.NewQuantity(int64(cpu), resource.DecimalExponent), - corev1.ResourceMemory: *resource.NewQuantity(int64(1024*1024*mem), resource.BinarySI), - } -} - -func CmpResourceQuantity(key string, nodeResourceList corev1.ResourceList, clusterResorceList clusterv1.ResourceList) bool { - nodeResource, ok := nodeResourceList[corev1.ResourceName(key)] - if !ok { - return false - } - clusterResouce, ok := clusterResorceList[clusterv1.ResourceName(key)] - if !ok { - return false - } - return nodeResource.Equal(clusterResouce) -} - -func NewIntegrationTestEventRecorder(componet string) events.Recorder { - return &IntegrationTestEventRecorder{component: componet} -} - -type IntegrationTestEventRecorder struct { - component string -} - -func (r *IntegrationTestEventRecorder) ComponentName() string { - return r.component -} - -func (r *IntegrationTestEventRecorder) ForComponent(c string) events.Recorder { - return &IntegrationTestEventRecorder{component: c} -} - -func (r *IntegrationTestEventRecorder) WithContext(ctx context.Context) events.Recorder { - return r -} - -func (r *IntegrationTestEventRecorder) WithComponentSuffix(suffix string) events.Recorder { - return r.ForComponent(fmt.Sprintf("%s-%s", r.ComponentName(), suffix)) -} - -func (r *IntegrationTestEventRecorder) Event(reason, message string) { - fmt.Fprintf(ginkgo.GinkgoWriter, "Event: [%s] %v: %v \n", r.component, reason, message) -} - -func (r *IntegrationTestEventRecorder) Eventf(reason, messageFmt string, args ...interface{}) { - r.Event(reason, fmt.Sprintf(messageFmt, args...)) -} - -func (r *IntegrationTestEventRecorder) Warning(reason, message string) { - fmt.Fprintf(ginkgo.GinkgoWriter, "Warning: [%s] %v: %v \n", r.component, reason, message) -} - -func (r *IntegrationTestEventRecorder) Warningf(reason, messageFmt string, args ...interface{}) { - r.Warning(reason, fmt.Sprintf(messageFmt, args...)) -} - -func (r *IntegrationTestEventRecorder) Shutdown() {} - -func RunAgent(name string, opt spoke.SpokeAgentOptions, cfg *rest.Config) context.CancelFunc { - ctx, cancel := context.WithCancel(context.Background()) - go func() { - err := opt.RunSpokeAgent(ctx, &controllercmd.ControllerContext{ - KubeConfig: cfg, - EventRecorder: NewIntegrationTestEventRecorder(name), - }) - if err != nil { - return - } - }() - - return cancel -} diff --git a/test/integration/util/certificate.go b/test/integration/util/certificate.go new file mode 100644 index 000000000..b89909233 --- /dev/null +++ b/test/integration/util/certificate.go @@ -0,0 +1,59 @@ +package util + +import ( + cryptorand "crypto/rand" + "crypto/rsa" + "crypto/x509" + "crypto/x509/pkix" + "encoding/pem" + "math/big" + "time" + + certutil "k8s.io/client-go/util/cert" +) + +func NewCert(notAfter time.Time) []byte { + caKey, err := rsa.GenerateKey(cryptorand.Reader, 2048) + if err != nil { + panic(err) + } + + caCert, err := certutil.NewSelfSignedCACert(certutil.Config{CommonName: "open-cluster-management.io"}, caKey) + if err != nil { + panic(err) + } + + key, err := rsa.GenerateKey(cryptorand.Reader, 2048) + if err != nil { + panic(err) + } + + certDERBytes, err := x509.CreateCertificate( + cryptorand.Reader, + &x509.Certificate{ + Subject: pkix.Name{ + CommonName: "test", + }, + SerialNumber: big.NewInt(1), + NotBefore: caCert.NotBefore, + NotAfter: notAfter, + KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}, + }, + caCert, + key.Public(), + caKey, + ) + if err != nil { + panic(err) + } + + cert, err := x509.ParseCertificate(certDERBytes) + if err != nil { + panic(err) + } + return pem.EncodeToMemory(&pem.Block{ + Type: certutil.CertificateBlockType, + Bytes: cert.Raw, + }) +} diff --git a/test/integration/util/kubeconfig.go b/test/integration/util/kubeconfig.go new file mode 100644 index 000000000..23502054a --- /dev/null +++ b/test/integration/util/kubeconfig.go @@ -0,0 +1,55 @@ +package util + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/rest" + "k8s.io/client-go/tools/clientcmd" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" + clientcmdlatest "k8s.io/client-go/tools/clientcmd/api/latest" +) + +func NewKubeConfig(config *rest.Config) []byte { + configData, _ := runtime.Encode(clientcmdlatest.Codec, &clientcmdapi.Config{ + Clusters: map[string]*clientcmdapi.Cluster{"test-cluster": { + Server: config.Host, + InsecureSkipTLSVerify: true, + }}, + Contexts: map[string]*clientcmdapi.Context{"test-context": { + Cluster: "test-cluster", + AuthInfo: "test-user", + }}, + AuthInfos: map[string]*clientcmdapi.AuthInfo{ + "test-user": { + ClientCertificateData: config.CertData, + ClientKeyData: config.KeyData, + }, + }, + CurrentContext: "test-context", + }) + return configData +} + +func CreateKubeconfigFile(clientConfig *rest.Config, filename string) error { + // Build kubeconfig. + kubeconfig := clientcmdapi.Config{ + Clusters: map[string]*clientcmdapi.Cluster{"default-cluster": { + Server: clientConfig.Host, + InsecureSkipTLSVerify: clientConfig.Insecure, + CertificateAuthorityData: clientConfig.CAData, + }}, + AuthInfos: map[string]*clientcmdapi.AuthInfo{"default-auth": { + ClientCertificate: clientConfig.CertFile, + ClientCertificateData: clientConfig.CertData, + ClientKey: clientConfig.KeyFile, + ClientKeyData: clientConfig.KeyData, + }}, + Contexts: map[string]*clientcmdapi.Context{"default-context": { + Cluster: "default-cluster", + AuthInfo: "default-auth", + Namespace: "configuration", + }}, + CurrentContext: "default-context", + } + + return clientcmd.WriteToFile(kubeconfig, filename) +} diff --git a/test/integration/util/managedcluster.go b/test/integration/util/managedcluster.go new file mode 100644 index 000000000..641ad556b --- /dev/null +++ b/test/integration/util/managedcluster.go @@ -0,0 +1,82 @@ +package util + +import ( + "context" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/util/retry" + clusterclientset "open-cluster-management.io/api/client/cluster/clientset/versioned" + clusterv1 "open-cluster-management.io/api/cluster/v1" +) + +func GetManagedCluster(clusterClient clusterclientset.Interface, spokeClusterName string) (*clusterv1.ManagedCluster, error) { + spokeCluster, err := clusterClient.ClusterV1().ManagedClusters().Get(context.TODO(), spokeClusterName, metav1.GetOptions{}) + if err != nil { + return nil, err + } + return spokeCluster, nil +} + +func AcceptManagedCluster(clusterClient clusterclientset.Interface, spokeClusterName string) error { + return AcceptManagedClusterWithLeaseDuration(clusterClient, spokeClusterName, 60) +} + +func AcceptManagedClusterWithLeaseDuration(clusterClient clusterclientset.Interface, spokeClusterName string, leaseDuration int32) error { + return retry.RetryOnConflict(retry.DefaultBackoff, func() error { + spokeCluster, err := GetManagedCluster(clusterClient, spokeClusterName) + if err != nil { + return err + } + spokeCluster.Spec.HubAcceptsClient = true + spokeCluster.Spec.LeaseDurationSeconds = leaseDuration + _, err = clusterClient.ClusterV1().ManagedClusters().Update(context.TODO(), spokeCluster, metav1.UpdateOptions{}) + return err + }) +} + +func CreateNode(kubeClient kubernetes.Interface, name string, capacity, allocatable corev1.ResourceList) error { + node := &corev1.Node{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + }, + Status: corev1.NodeStatus{ + Capacity: capacity, + Allocatable: allocatable, + }, + } + _, err := kubeClient.CoreV1().Nodes().Create(context.TODO(), node, metav1.CreateOptions{}) + return err +} + +func CordonNode(kubeClient kubernetes.Interface, name string) error { + node, err := kubeClient.CoreV1().Nodes().Get(context.TODO(), name, metav1.GetOptions{}) + if err != nil { + return err + } + + node = node.DeepCopy() + node.Spec.Unschedulable = true + _, err = kubeClient.CoreV1().Nodes().Update(context.TODO(), node, metav1.UpdateOptions{}) + return err +} + +func NewResourceList(cpu, mem int) corev1.ResourceList { + return corev1.ResourceList{ + corev1.ResourceCPU: *resource.NewQuantity(int64(cpu), resource.DecimalExponent), + corev1.ResourceMemory: *resource.NewQuantity(int64(1024*1024*mem), resource.BinarySI), + } +} + +func CmpResourceQuantity(key string, nodeResourceList corev1.ResourceList, clusterResorceList clusterv1.ResourceList) bool { + nodeResource, ok := nodeResourceList[corev1.ResourceName(key)] + if !ok { + return false + } + clusterResouce, ok := clusterResorceList[clusterv1.ResourceName(key)] + if !ok { + return false + } + return nodeResource.Equal(clusterResouce) +} diff --git a/test/placement/util/util.go b/test/integration/util/recorder.go similarity index 100% rename from test/placement/util/util.go rename to test/integration/util/recorder.go diff --git a/test/integration/util/structured.go b/test/integration/util/structured.go new file mode 100644 index 000000000..9ba595b73 --- /dev/null +++ b/test/integration/util/structured.go @@ -0,0 +1,105 @@ +package util + +import ( + "context" + corev1 "k8s.io/api/core/v1" + rbacv1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/kubernetes" + workapiv1 "open-cluster-management.io/api/work/v1" +) + +func NewManifestWork(namespace, name string, manifests []workapiv1.Manifest) *workapiv1.ManifestWork { + work := &workapiv1.ManifestWork{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: namespace, + }, + Spec: workapiv1.ManifestWorkSpec{ + Workload: workapiv1.ManifestsTemplate{ + Manifests: manifests, + }, + }, + } + + if name != "" { + work.Name = name + } else { + work.GenerateName = "work-" + } + + return work +} + +func NewConfigmap(namespace, name string, data map[string]string, finalizers []string) *corev1.ConfigMap { + cm := &corev1.ConfigMap{ + TypeMeta: metav1.TypeMeta{ + Kind: "ConfigMap", + APIVersion: "v1", + }, + ObjectMeta: metav1.ObjectMeta{ + Namespace: namespace, + Name: name, + Finalizers: finalizers, + }, + Data: data, + } + + return cm +} + +func NewRoleForManifest(namespace, name string, rules ...rbacv1.PolicyRule) *rbacv1.Role { + return &rbacv1.Role{ + TypeMeta: metav1.TypeMeta{ + Kind: "Role", + APIVersion: "rbac.authorization.k8s.io/v1", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: namespace, + }, + Rules: rules, + } +} + +func NewRoleBindingForManifest(namespace, name string, rule rbacv1.RoleRef, + subjects ...rbacv1.Subject) *rbacv1.RoleBinding { + return &rbacv1.RoleBinding{ + TypeMeta: metav1.TypeMeta{ + Kind: "RoleBinding", + APIVersion: "rbac.authorization.k8s.io/v1", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: namespace, + }, + Subjects: subjects, + RoleRef: rule, + } +} + +func ToManifest(object runtime.Object) workapiv1.Manifest { + manifest := workapiv1.Manifest{} + manifest.Object = object + return manifest +} + +func RemoveConfigmapFinalizers(kubeClient kubernetes.Interface, namespace string, names ...string) error { + for _, name := range names { + cm, err := kubeClient.CoreV1().ConfigMaps(namespace).Get(context.Background(), name, metav1.GetOptions{}) + if errors.IsNotFound(err) { + continue + } + if err != nil { + return err + } + cm.Finalizers = nil + _, err = kubeClient.CoreV1().ConfigMaps(cm.Namespace).Update(context.Background(), cm, metav1.UpdateOptions{}) + if err != nil { + return err + } + } + + return nil +} diff --git a/test/work/integration/util/unstructured.go b/test/integration/util/unstructured.go similarity index 100% rename from test/work/integration/util/unstructured.go rename to test/integration/util/unstructured.go diff --git a/test/work/integration/deleteoption_test.go b/test/integration/work/deleteoption_test.go similarity index 99% rename from test/work/integration/deleteoption_test.go rename to test/integration/work/deleteoption_test.go index 02cba5042..f0e819208 100644 --- a/test/work/integration/deleteoption_test.go +++ b/test/integration/work/deleteoption_test.go @@ -1,8 +1,9 @@ -package integration +package work import ( "context" "fmt" + "open-cluster-management.io/ocm/test/integration/util" "time" "github.com/onsi/ginkgo/v2" @@ -13,7 +14,6 @@ import ( utilrand "k8s.io/apimachinery/pkg/util/rand" workapiv1 "open-cluster-management.io/api/work/v1" "open-cluster-management.io/ocm/pkg/work/spoke" - "open-cluster-management.io/ocm/test/work/integration/util" ) var _ = ginkgo.Describe("ManifestWork Status Feedback", func() { diff --git a/test/work/integration/doc.go b/test/integration/work/doc.go similarity index 88% rename from test/work/integration/doc.go rename to test/integration/work/doc.go index 7e6bdb3b3..912eb1042 100644 --- a/test/work/integration/doc.go +++ b/test/integration/work/doc.go @@ -2,4 +2,4 @@ // - create work // - update work // - delete work -package integration +package work diff --git a/test/work/integration/executor_test.go b/test/integration/work/executor_test.go similarity index 99% rename from test/work/integration/executor_test.go rename to test/integration/work/executor_test.go index 35a4ded54..89b515379 100644 --- a/test/work/integration/executor_test.go +++ b/test/integration/work/executor_test.go @@ -1,9 +1,10 @@ -package integration +package work import ( "context" "encoding/json" "open-cluster-management.io/ocm/pkg/features" + "open-cluster-management.io/ocm/test/integration/util" "time" jsonpatch "github.com/evanphx/json-patch" @@ -17,7 +18,6 @@ import ( workclientset "open-cluster-management.io/api/client/work/clientset/versioned" workapiv1 "open-cluster-management.io/api/work/v1" "open-cluster-management.io/ocm/pkg/work/spoke" - "open-cluster-management.io/ocm/test/work/integration/util" ) var _ = ginkgo.Describe("ManifestWork Executor Subject", func() { diff --git a/test/work/integration/manifestworkreplicaset_test.go b/test/integration/work/manifestworkreplicaset_test.go similarity index 99% rename from test/work/integration/manifestworkreplicaset_test.go rename to test/integration/work/manifestworkreplicaset_test.go index 48dac0440..4d9a51b0d 100644 --- a/test/work/integration/manifestworkreplicaset_test.go +++ b/test/integration/work/manifestworkreplicaset_test.go @@ -1,8 +1,9 @@ -package integration +package work import ( "context" "fmt" + "open-cluster-management.io/ocm/test/integration/util" "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" @@ -14,7 +15,6 @@ import ( clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" workapiv1 "open-cluster-management.io/api/work/v1" workapiv1alpha1 "open-cluster-management.io/api/work/v1alpha1" - "open-cluster-management.io/ocm/test/work/integration/util" ) var _ = ginkgo.Describe("ManifestWorkReplicaSet", func() { diff --git a/test/work/integration/statusfeedback_test.go b/test/integration/work/statusfeedback_test.go similarity index 99% rename from test/work/integration/statusfeedback_test.go rename to test/integration/work/statusfeedback_test.go index 12c271ff0..36299a3e6 100644 --- a/test/work/integration/statusfeedback_test.go +++ b/test/integration/work/statusfeedback_test.go @@ -1,9 +1,10 @@ -package integration +package work import ( "context" "fmt" "open-cluster-management.io/ocm/pkg/features" + "open-cluster-management.io/ocm/test/integration/util" "time" "github.com/onsi/ginkgo/v2" @@ -17,7 +18,6 @@ import ( ocmfeature "open-cluster-management.io/api/feature" workapiv1 "open-cluster-management.io/api/work/v1" "open-cluster-management.io/ocm/pkg/work/spoke" - "open-cluster-management.io/ocm/test/work/integration/util" ) var _ = ginkgo.Describe("ManifestWork Status Feedback", func() { diff --git a/test/work/integration/suite_test.go b/test/integration/work/suite_test.go similarity index 97% rename from test/work/integration/suite_test.go rename to test/integration/work/suite_test.go index 4d830e7d1..61725786b 100644 --- a/test/work/integration/suite_test.go +++ b/test/integration/work/suite_test.go @@ -1,7 +1,8 @@ -package integration +package work import ( "context" + "open-cluster-management.io/ocm/test/integration/util" "os" "path" "testing" @@ -23,7 +24,6 @@ import ( workclientset "open-cluster-management.io/api/client/work/clientset/versioned" workapiv1 "open-cluster-management.io/api/work/v1" "open-cluster-management.io/ocm/pkg/work/helper" - "open-cluster-management.io/ocm/test/work/integration/util" ) const ( diff --git a/test/work/integration/unmanaged_appliedwork_test.go b/test/integration/work/unmanaged_appliedwork_test.go similarity index 99% rename from test/work/integration/unmanaged_appliedwork_test.go rename to test/integration/work/unmanaged_appliedwork_test.go index 124f984cf..96c28cd35 100644 --- a/test/work/integration/unmanaged_appliedwork_test.go +++ b/test/integration/work/unmanaged_appliedwork_test.go @@ -1,8 +1,9 @@ -package integration +package work import ( "context" "fmt" + util "open-cluster-management.io/ocm/test/integration/util" "os" "path" "time" @@ -17,7 +18,6 @@ import ( workclientset "open-cluster-management.io/api/client/work/clientset/versioned" workapiv1 "open-cluster-management.io/api/work/v1" "open-cluster-management.io/ocm/pkg/work/spoke" - "open-cluster-management.io/ocm/test/work/integration/util" "sigs.k8s.io/controller-runtime/pkg/envtest" ) diff --git a/test/work/integration/updatestrategy_test.go b/test/integration/work/updatestrategy_test.go similarity index 99% rename from test/work/integration/updatestrategy_test.go rename to test/integration/work/updatestrategy_test.go index 2b25eab3c..bfeac9b9c 100644 --- a/test/work/integration/updatestrategy_test.go +++ b/test/integration/work/updatestrategy_test.go @@ -1,8 +1,9 @@ -package integration +package work import ( "context" "fmt" + "open-cluster-management.io/ocm/test/integration/util" "time" "github.com/onsi/ginkgo/v2" @@ -15,7 +16,6 @@ import ( "k8s.io/utils/pointer" workapiv1 "open-cluster-management.io/api/work/v1" "open-cluster-management.io/ocm/pkg/work/spoke" - "open-cluster-management.io/ocm/test/work/integration/util" ) var _ = ginkgo.Describe("ManifestWork Update Strategy", func() { diff --git a/test/work/integration/work_test.go b/test/integration/work/work_test.go similarity index 97% rename from test/work/integration/work_test.go rename to test/integration/work/work_test.go index a52a07ac6..94659414c 100644 --- a/test/work/integration/work_test.go +++ b/test/integration/work/work_test.go @@ -1,8 +1,9 @@ -package integration +package work import ( "context" "fmt" + "open-cluster-management.io/ocm/test/integration/util" "time" "github.com/onsi/ginkgo/v2" @@ -20,7 +21,6 @@ import ( workapiv1 "open-cluster-management.io/api/work/v1" "open-cluster-management.io/ocm/pkg/work/spoke" - "open-cluster-management.io/ocm/test/work/integration/util" ) func startWorkAgent(ctx context.Context, o *spoke.WorkloadAgentOptions) { @@ -69,11 +69,28 @@ var _ = ginkgo.Describe("ManifestWork", func() { }) ginkgo.AfterEach(func() { + err = hubWorkClient.WorkV1().ManifestWorks(o.SpokeClusterName).Delete(context.Background(), work.Name, metav1.DeleteOptions{}) + if !errors.IsNotFound(err) { + gomega.Expect(err).ToNot(gomega.HaveOccurred()) + } + + gomega.Eventually(func() error { + _, err := hubWorkClient.WorkV1().ManifestWorks(o.SpokeClusterName).Get(context.Background(), work.Name, metav1.GetOptions{}) + if errors.IsNotFound(err) { + return nil + } + if err != nil { + return err + } + return fmt.Errorf("work %s in namespace %s still exists", work.Name, o.SpokeClusterName) + }, eventuallyTimeout, eventuallyInterval).Should(gomega.Succeed()) + + err := spokeKubeClient.CoreV1().Namespaces().Delete(context.Background(), o.SpokeClusterName, metav1.DeleteOptions{}) + gomega.Expect(err).ToNot(gomega.HaveOccurred()) + if cancel != nil { cancel() } - err := spokeKubeClient.CoreV1().Namespaces().Delete(context.Background(), o.SpokeClusterName, metav1.DeleteOptions{}) - gomega.Expect(err).ToNot(gomega.HaveOccurred()) }) ginkgo.Context("With a single manifest", func() { @@ -591,6 +608,11 @@ var _ = ginkgo.Describe("ManifestWork", func() { } }) + ginkgo.AfterEach(func() { + err = util.RemoveConfigmapFinalizers(spokeKubeClient, o.SpokeClusterName, "cm1", "cm2", "cm3") + gomega.Expect(err).ToNot(gomega.HaveOccurred()) + }) + ginkgo.It("should remove applied resource for stale manifest from list once the resource is gone", func() { util.AssertExistenceOfConfigMaps(manifests, spokeKubeClient, eventuallyTimeout, eventuallyInterval) @@ -613,12 +635,8 @@ var _ = ginkgo.Describe("ManifestWork", func() { // remove finalizer from the applied resources for stale manifest after 2 seconds go func() { time.Sleep(2 * time.Second) - cm := manifests[0].Object.(*corev1.ConfigMap) - cm, err := spokeKubeClient.CoreV1().ConfigMaps(cm.Namespace).Get(context.Background(), cm.Name, metav1.GetOptions{}) - if err == nil { - cm.Finalizers = nil - _, _ = spokeKubeClient.CoreV1().ConfigMaps(cm.Namespace).Update(context.Background(), cm, metav1.UpdateOptions{}) - } + // remove finalizers of cm1 + _ = util.RemoveConfigmapFinalizers(spokeKubeClient, o.SpokeClusterName, "cm1") }() // check if resource created by stale manifest is deleted once it is removed from applied resource list diff --git a/test/registration-operator/integration/util/assertion.go b/test/registration-operator/integration/util/assertion.go deleted file mode 100644 index e1581f9f2..000000000 --- a/test/registration-operator/integration/util/assertion.go +++ /dev/null @@ -1,51 +0,0 @@ -package util - -import ( - "context" - "fmt" - - "github.com/onsi/gomega" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - operatorclientset "open-cluster-management.io/api/client/operator/clientset/versioned" -) - -const ( - eventuallyTimeout = 60 // seconds - eventuallyInterval = 1 // seconds -) - -func AssertKlusterletCondition( - name string, operatorClient operatorclientset.Interface, expectedType, expectedReason string, expectedWorkStatus metav1.ConditionStatus) { - gomega.Eventually(func() error { - klusterlet, err := operatorClient.OperatorV1().Klusterlets().Get(context.Background(), name, metav1.GetOptions{}) - if err != nil { - return err - } - - // check work status condition - if !HasCondition(klusterlet.Status.Conditions, expectedType, expectedReason, expectedWorkStatus) { - return fmt.Errorf("expect have type %s with reason %s and status %s, but got %v", - expectedType, expectedReason, expectedWorkStatus, klusterlet.Status.Conditions) - } - return nil - }, eventuallyTimeout, eventuallyInterval).ShouldNot(gomega.HaveOccurred()) -} - -func AssertClusterManagerCondition( - name string, operatorClient operatorclientset.Interface, expectedType, expectedReason string, expectedWorkStatus metav1.ConditionStatus) { - gomega.Eventually(func() error { - clusterManager, err := operatorClient.OperatorV1().ClusterManagers().Get(context.Background(), name, metav1.GetOptions{}) - if err != nil { - return err - } - - // check work status condition - if !HasCondition(clusterManager.Status.Conditions, expectedType, expectedReason, expectedWorkStatus) { - return fmt.Errorf("expect have type %s with reason %s and status %s, but got %v", - expectedType, expectedReason, expectedWorkStatus, clusterManager.Status.Conditions) - } - return nil - }, eventuallyTimeout, eventuallyInterval).ShouldNot(gomega.HaveOccurred()) -} diff --git a/test/registration-operator/integration/util/util.go b/test/registration-operator/integration/util/util.go deleted file mode 100644 index 752cb2aff..000000000 --- a/test/registration-operator/integration/util/util.go +++ /dev/null @@ -1,152 +0,0 @@ -package util - -import ( - "context" - cryptorand "crypto/rand" - "crypto/rsa" - "crypto/x509" - "crypto/x509/pkix" - "encoding/pem" - "fmt" - "math/big" - "time" - - "github.com/onsi/ginkgo/v2" - - "github.com/openshift/library-go/pkg/operator/events" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/client-go/rest" - clientcmdapi "k8s.io/client-go/tools/clientcmd/api" - clientcmdlatest "k8s.io/client-go/tools/clientcmd/api/latest" - certutil "k8s.io/client-go/util/cert" -) - -func NewIntegrationTestEventRecorder(componet string) events.Recorder { - return &IntegrationTestEventRecorder{component: componet} -} - -type IntegrationTestEventRecorder struct { - component string -} - -func (r *IntegrationTestEventRecorder) ComponentName() string { - return r.component -} - -func (r *IntegrationTestEventRecorder) WithContext(ctx context.Context) events.Recorder { - return r -} - -func (r *IntegrationTestEventRecorder) ForComponent(c string) events.Recorder { - return &IntegrationTestEventRecorder{component: c} -} - -func (r *IntegrationTestEventRecorder) WithComponentSuffix(suffix string) events.Recorder { - return r.ForComponent(fmt.Sprintf("%s-%s", r.ComponentName(), suffix)) -} - -func (r *IntegrationTestEventRecorder) Event(reason, message string) { - fmt.Fprintf(ginkgo.GinkgoWriter, "Event: [%s] %v: %v \n", r.component, reason, message) -} - -func (r *IntegrationTestEventRecorder) Eventf(reason, messageFmt string, args ...interface{}) { - r.Event(reason, fmt.Sprintf(messageFmt, args...)) -} - -func (r *IntegrationTestEventRecorder) Warning(reason, message string) { - fmt.Fprintf(ginkgo.GinkgoWriter, "Warning: [%s] %v: %v \n", r.component, reason, message) -} - -func (r *IntegrationTestEventRecorder) Warningf(reason, messageFmt string, args ...interface{}) { - r.Warning(reason, fmt.Sprintf(messageFmt, args...)) -} - -func (r *IntegrationTestEventRecorder) Shutdown() {} - -func HasCondition(conditions []metav1.Condition, expectedType, expectedReason string, expectedStatus metav1.ConditionStatus) bool { - for _, condition := range conditions { - if condition.Type != expectedType { - continue - } - - if condition.Status != expectedStatus { - return false - } - - if condition.Reason != expectedReason { - return false - } - - return true - } - - return false -} - -func NewKubeConfig(config *rest.Config) []byte { - configData, _ := runtime.Encode(clientcmdlatest.Codec, &clientcmdapi.Config{ - Clusters: map[string]*clientcmdapi.Cluster{"test-cluster": { - Server: config.Host, - InsecureSkipTLSVerify: true, - }}, - Contexts: map[string]*clientcmdapi.Context{"test-context": { - Cluster: "test-cluster", - AuthInfo: "test-user", - }}, - AuthInfos: map[string]*clientcmdapi.AuthInfo{ - "test-user": { - ClientCertificateData: config.CertData, - ClientKeyData: config.KeyData, - }, - }, - CurrentContext: "test-context", - }) - return configData -} - -func NewCert(notAfter time.Time) []byte { - caKey, err := rsa.GenerateKey(cryptorand.Reader, 2048) - if err != nil { - panic(err) - } - - caCert, err := certutil.NewSelfSignedCACert(certutil.Config{CommonName: "open-cluster-management.io"}, caKey) - if err != nil { - panic(err) - } - - key, err := rsa.GenerateKey(cryptorand.Reader, 2048) - if err != nil { - panic(err) - } - - certDERBytes, err := x509.CreateCertificate( - cryptorand.Reader, - &x509.Certificate{ - Subject: pkix.Name{ - CommonName: "test", - }, - SerialNumber: big.NewInt(1), - NotBefore: caCert.NotBefore, - NotAfter: notAfter, - KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}, - }, - caCert, - key.Public(), - caKey, - ) - if err != nil { - panic(err) - } - - cert, err := x509.ParseCertificate(certDERBytes) - if err != nil { - panic(err) - } - return pem.EncodeToMemory(&pem.Block{ - Type: certutil.CertificateBlockType, - Bytes: cert.Raw, - }) -} diff --git a/test/work/integration/report.xml b/test/work/integration/report.xml deleted file mode 100644 index 104568ebb..000000000 --- a/test/work/integration/report.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/test/work/integration/util/util.go b/test/work/integration/util/util.go deleted file mode 100644 index a214803d5..000000000 --- a/test/work/integration/util/util.go +++ /dev/null @@ -1,182 +0,0 @@ -package util - -import ( - "context" - "fmt" - - "github.com/onsi/ginkgo/v2" - - "github.com/openshift/library-go/pkg/operator/events" - corev1 "k8s.io/api/core/v1" - rbacv1 "k8s.io/api/rbac/v1" - "k8s.io/apimachinery/pkg/api/meta" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/client-go/rest" - "k8s.io/client-go/tools/clientcmd" - clientcmdapi "k8s.io/client-go/tools/clientcmd/api" - - workapiv1 "open-cluster-management.io/api/work/v1" -) - -func HaveManifestCondition(conditions []workapiv1.ManifestCondition, expectedType string, expectedStatuses []metav1.ConditionStatus) bool { - if len(conditions) != len(expectedStatuses) { - return false - } - - for index, condition := range conditions { - expectedStatus := expectedStatuses[index] - if expectedStatus == "" { - continue - } - - if ok := meta.IsStatusConditionPresentAndEqual(condition.Conditions, expectedType, expectedStatus); !ok { - return false - } - } - - return true -} - -func NewManifestWork(namespace, name string, manifests []workapiv1.Manifest) *workapiv1.ManifestWork { - work := &workapiv1.ManifestWork{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: namespace, - }, - Spec: workapiv1.ManifestWorkSpec{ - Workload: workapiv1.ManifestsTemplate{ - Manifests: manifests, - }, - }, - } - - if name != "" { - work.Name = name - } else { - work.GenerateName = "work-" - } - - return work -} - -func NewConfigmap(namespace, name string, data map[string]string, finalizers []string) *corev1.ConfigMap { - cm := &corev1.ConfigMap{ - TypeMeta: metav1.TypeMeta{ - Kind: "ConfigMap", - APIVersion: "v1", - }, - ObjectMeta: metav1.ObjectMeta{ - Namespace: namespace, - Name: name, - Finalizers: finalizers, - }, - Data: data, - } - - return cm -} - -func NewRoleForManifest(namespace, name string, rules ...rbacv1.PolicyRule) *rbacv1.Role { - return &rbacv1.Role{ - TypeMeta: metav1.TypeMeta{ - Kind: "Role", - APIVersion: "rbac.authorization.k8s.io/v1", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - }, - Rules: rules, - } -} - -func NewRoleBindingForManifest(namespace, name string, rule rbacv1.RoleRef, - subjects ...rbacv1.Subject) *rbacv1.RoleBinding { - return &rbacv1.RoleBinding{ - TypeMeta: metav1.TypeMeta{ - Kind: "RoleBinding", - APIVersion: "rbac.authorization.k8s.io/v1", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - }, - Subjects: subjects, - RoleRef: rule, - } -} - -func ToManifest(object runtime.Object) workapiv1.Manifest { - manifest := workapiv1.Manifest{} - manifest.Object = object - return manifest -} - -func CreateKubeconfigFile(clientConfig *rest.Config, filename string) error { - // Build kubeconfig. - kubeconfig := clientcmdapi.Config{ - Clusters: map[string]*clientcmdapi.Cluster{"default-cluster": { - Server: clientConfig.Host, - InsecureSkipTLSVerify: clientConfig.Insecure, - CertificateAuthorityData: clientConfig.CAData, - }}, - AuthInfos: map[string]*clientcmdapi.AuthInfo{"default-auth": { - ClientCertificate: clientConfig.CertFile, - ClientCertificateData: clientConfig.CertData, - ClientKey: clientConfig.KeyFile, - ClientKeyData: clientConfig.KeyData, - }}, - Contexts: map[string]*clientcmdapi.Context{"default-context": { - Cluster: "default-cluster", - AuthInfo: "default-auth", - Namespace: "configuration", - }}, - CurrentContext: "default-context", - } - - return clientcmd.WriteToFile(kubeconfig, filename) -} - -func NewIntegrationTestEventRecorder(componet string) events.Recorder { - return &IntegrationTestEventRecorder{component: componet} -} - -type IntegrationTestEventRecorder struct { - component string -} - -func (r *IntegrationTestEventRecorder) ComponentName() string { - return r.component -} - -func (r *IntegrationTestEventRecorder) WithContext(ctx context.Context) events.Recorder { - return r -} - -func (r *IntegrationTestEventRecorder) ForComponent(c string) events.Recorder { - r.component = c - return r -} - -func (r *IntegrationTestEventRecorder) WithComponentSuffix(suffix string) events.Recorder { - return r.ForComponent(fmt.Sprintf("%s-%s", r.ComponentName(), suffix)) -} - -func (r *IntegrationTestEventRecorder) Event(reason, message string) { - fmt.Fprintf(ginkgo.GinkgoWriter, "Event: [%s] %v: %v \n", r.component, reason, message) -} - -func (r *IntegrationTestEventRecorder) Eventf(reason, messageFmt string, args ...interface{}) { - r.Event(reason, fmt.Sprintf(messageFmt, args...)) -} - -func (r *IntegrationTestEventRecorder) Warning(reason, message string) { - fmt.Fprintf(ginkgo.GinkgoWriter, "Warning: [%s] %v: %v \n", r.component, reason, message) -} - -func (r *IntegrationTestEventRecorder) Warningf(reason, messageFmt string, args ...interface{}) { - r.Warning(reason, fmt.Sprintf(messageFmt, args...)) -} - -func (r *IntegrationTestEventRecorder) Shutdown() { -} diff --git a/vendor/golang.org/x/net/html/doc.go b/vendor/golang.org/x/net/html/doc.go index 7a96eae33..2466ae3d9 100644 --- a/vendor/golang.org/x/net/html/doc.go +++ b/vendor/golang.org/x/net/html/doc.go @@ -99,14 +99,20 @@ Care should be taken when parsing and interpreting HTML, whether full documents or fragments, within the framework of the HTML specification, especially with regard to untrusted inputs. -This package provides both a tokenizer and a parser. Only the parser constructs -a DOM according to the HTML specification, resolving malformed and misplaced -tags where appropriate. The tokenizer simply tokenizes the HTML presented to it, -and as such does not resolve issues that may exist in the processed HTML, -producing a literal interpretation of the input. +This package provides both a tokenizer and a parser, which implement the +tokenization, and tokenization and tree construction stages of the WHATWG HTML +parsing specification respectively. While the tokenizer parses and normalizes +individual HTML tokens, only the parser constructs the DOM tree from the +tokenized HTML, as described in the tree construction stage of the +specification, dynamically modifying or extending the docuemnt's DOM tree. -If your use case requires semantically well-formed HTML, as defined by the -WHATWG specifiction, the parser should be used rather than the tokenizer. +If your use case requires semantically well-formed HTML documents, as defined by +the WHATWG specification, the parser should be used rather than the tokenizer. + +In security contexts, if trust decisions are being made using the tokenized or +parsed content, the input must be re-serialized (for instance by using Render or +Token.String) in order for those trust decisions to hold, as the process of +tokenization or parsing may alter the content. */ package html // import "golang.org/x/net/html" diff --git a/vendor/golang.org/x/net/http2/pipe.go b/vendor/golang.org/x/net/http2/pipe.go index c15b8a771..684d984fd 100644 --- a/vendor/golang.org/x/net/http2/pipe.go +++ b/vendor/golang.org/x/net/http2/pipe.go @@ -88,13 +88,9 @@ func (p *pipe) Write(d []byte) (n int, err error) { p.c.L = &p.mu } defer p.c.Signal() - if p.err != nil { + if p.err != nil || p.breakErr != nil { return 0, errClosedPipeWrite } - if p.breakErr != nil { - p.unread += len(d) - return len(d), nil // discard when there is no reader - } return p.b.Write(d) } diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go index 8cb14f3c9..cd057f398 100644 --- a/vendor/golang.org/x/net/http2/server.go +++ b/vendor/golang.org/x/net/http2/server.go @@ -1822,15 +1822,18 @@ func (sc *serverConn) processData(f *DataFrame) error { } if len(data) > 0 { + st.bodyBytes += int64(len(data)) wrote, err := st.body.Write(data) if err != nil { + // The handler has closed the request body. + // Return the connection-level flow control for the discarded data, + // but not the stream-level flow control. sc.sendWindowUpdate(nil, int(f.Length)-wrote) - return sc.countError("body_write_err", streamError(id, ErrCodeStreamClosed)) + return nil } if wrote != len(data) { panic("internal error: bad Writer") } - st.bodyBytes += int64(len(data)) } // Return any padded flow control now, since we won't diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go index 05ba23d3d..ac90a2631 100644 --- a/vendor/golang.org/x/net/http2/transport.go +++ b/vendor/golang.org/x/net/http2/transport.go @@ -560,10 +560,11 @@ func (t *Transport) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Res traceGotConn(req, cc, reused) res, err := cc.RoundTrip(req) if err != nil && retry <= 6 { + roundTripErr := err if req, err = shouldRetryRequest(req, err); err == nil { // After the first retry, do exponential backoff with 10% jitter. if retry == 0 { - t.vlogf("RoundTrip retrying after failure: %v", err) + t.vlogf("RoundTrip retrying after failure: %v", roundTripErr) continue } backoff := float64(uint(1) << (uint(retry) - 1)) @@ -572,7 +573,7 @@ func (t *Transport) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Res timer := backoffNewTimer(d) select { case <-timer.C: - t.vlogf("RoundTrip retrying after failure: %v", err) + t.vlogf("RoundTrip retrying after failure: %v", roundTripErr) continue case <-req.Context().Done(): timer.Stop() @@ -1265,6 +1266,27 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) { return res, nil } + cancelRequest := func(cs *clientStream, err error) error { + cs.cc.mu.Lock() + defer cs.cc.mu.Unlock() + cs.abortStreamLocked(err) + if cs.ID != 0 { + // This request may have failed because of a problem with the connection, + // or for some unrelated reason. (For example, the user might have canceled + // the request without waiting for a response.) Mark the connection as + // not reusable, since trying to reuse a dead connection is worse than + // unnecessarily creating a new one. + // + // If cs.ID is 0, then the request was never allocated a stream ID and + // whatever went wrong was unrelated to the connection. We might have + // timed out waiting for a stream slot when StrictMaxConcurrentStreams + // is set, for example, in which case retrying on a different connection + // will not help. + cs.cc.doNotReuse = true + } + return err + } + for { select { case <-cs.respHeaderRecv: @@ -1279,15 +1301,12 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) { return handleResponseHeaders() default: waitDone() - return nil, cs.abortErr + return nil, cancelRequest(cs, cs.abortErr) } case <-ctx.Done(): - err := ctx.Err() - cs.abortStream(err) - return nil, err + return nil, cancelRequest(cs, ctx.Err()) case <-cs.reqCancel: - cs.abortStream(errRequestCanceled) - return nil, errRequestCanceled + return nil, cancelRequest(cs, errRequestCanceled) } } } @@ -2555,6 +2574,9 @@ func (b transportResponseBody) Close() error { cs := b.cs cc := cs.cc + cs.bufPipe.BreakWithError(errClosedResponseBody) + cs.abortStream(errClosedResponseBody) + unread := cs.bufPipe.Len() if unread > 0 { cc.mu.Lock() @@ -2573,9 +2595,6 @@ func (b transportResponseBody) Close() error { cc.wmu.Unlock() } - cs.bufPipe.BreakWithError(errClosedResponseBody) - cs.abortStream(errClosedResponseBody) - select { case <-cs.donec: case <-cs.ctx.Done(): diff --git a/vendor/golang.org/x/sys/unix/ioctl_signed.go b/vendor/golang.org/x/sys/unix/ioctl_signed.go new file mode 100644 index 000000000..7def9580e --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ioctl_signed.go @@ -0,0 +1,70 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build aix || solaris +// +build aix solaris + +package unix + +import ( + "unsafe" +) + +// ioctl itself should not be exposed directly, but additional get/set +// functions for specific types are permissible. + +// IoctlSetInt performs an ioctl operation which sets an integer value +// on fd, using the specified request number. +func IoctlSetInt(fd int, req int, value int) error { + return ioctl(fd, req, uintptr(value)) +} + +// IoctlSetPointerInt performs an ioctl operation which sets an +// integer value on fd, using the specified request number. The ioctl +// argument is called with a pointer to the integer value, rather than +// passing the integer value directly. +func IoctlSetPointerInt(fd int, req int, value int) error { + v := int32(value) + return ioctlPtr(fd, req, unsafe.Pointer(&v)) +} + +// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. +// +// To change fd's window size, the req argument should be TIOCSWINSZ. +func IoctlSetWinsize(fd int, req int, value *Winsize) error { + // TODO: if we get the chance, remove the req parameter and + // hardcode TIOCSWINSZ. + return ioctlPtr(fd, req, unsafe.Pointer(value)) +} + +// IoctlSetTermios performs an ioctl on fd with a *Termios. +// +// The req value will usually be TCSETA or TIOCSETA. +func IoctlSetTermios(fd int, req int, value *Termios) error { + // TODO: if we get the chance, remove the req parameter. + return ioctlPtr(fd, req, unsafe.Pointer(value)) +} + +// IoctlGetInt performs an ioctl operation which gets an integer value +// from fd, using the specified request number. +// +// A few ioctl requests use the return value as an output parameter; +// for those, IoctlRetInt should be used instead of this function. +func IoctlGetInt(fd int, req int) (int, error) { + var value int + err := ioctlPtr(fd, req, unsafe.Pointer(&value)) + return value, err +} + +func IoctlGetWinsize(fd int, req int) (*Winsize, error) { + var value Winsize + err := ioctlPtr(fd, req, unsafe.Pointer(&value)) + return &value, err +} + +func IoctlGetTermios(fd int, req int) (*Termios, error) { + var value Termios + err := ioctlPtr(fd, req, unsafe.Pointer(&value)) + return &value, err +} diff --git a/vendor/golang.org/x/sys/unix/ioctl.go b/vendor/golang.org/x/sys/unix/ioctl_unsigned.go similarity index 92% rename from vendor/golang.org/x/sys/unix/ioctl.go rename to vendor/golang.org/x/sys/unix/ioctl_unsigned.go index 7ce8dd406..649913d1e 100644 --- a/vendor/golang.org/x/sys/unix/ioctl.go +++ b/vendor/golang.org/x/sys/unix/ioctl_unsigned.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build aix || darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd hurd linux netbsd openbsd solaris +//go:build darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd +// +build darwin dragonfly freebsd hurd linux netbsd openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ioctl_zos.go b/vendor/golang.org/x/sys/unix/ioctl_zos.go index 6532f09af..cdc21bf76 100644 --- a/vendor/golang.org/x/sys/unix/ioctl_zos.go +++ b/vendor/golang.org/x/sys/unix/ioctl_zos.go @@ -17,14 +17,14 @@ import ( // IoctlSetInt performs an ioctl operation which sets an integer value // on fd, using the specified request number. -func IoctlSetInt(fd int, req uint, value int) error { +func IoctlSetInt(fd int, req int, value int) error { return ioctl(fd, req, uintptr(value)) } // IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. // // To change fd's window size, the req argument should be TIOCSWINSZ. -func IoctlSetWinsize(fd int, req uint, value *Winsize) error { +func IoctlSetWinsize(fd int, req int, value *Winsize) error { // TODO: if we get the chance, remove the req parameter and // hardcode TIOCSWINSZ. return ioctlPtr(fd, req, unsafe.Pointer(value)) @@ -33,7 +33,7 @@ func IoctlSetWinsize(fd int, req uint, value *Winsize) error { // IoctlSetTermios performs an ioctl on fd with a *Termios. // // The req value is expected to be TCSETS, TCSETSW, or TCSETSF -func IoctlSetTermios(fd int, req uint, value *Termios) error { +func IoctlSetTermios(fd int, req int, value *Termios) error { if (req != TCSETS) && (req != TCSETSW) && (req != TCSETSF) { return ENOSYS } @@ -47,13 +47,13 @@ func IoctlSetTermios(fd int, req uint, value *Termios) error { // // A few ioctl requests use the return value as an output parameter; // for those, IoctlRetInt should be used instead of this function. -func IoctlGetInt(fd int, req uint) (int, error) { +func IoctlGetInt(fd int, req int) (int, error) { var value int err := ioctlPtr(fd, req, unsafe.Pointer(&value)) return value, err } -func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { +func IoctlGetWinsize(fd int, req int) (*Winsize, error) { var value Winsize err := ioctlPtr(fd, req, unsafe.Pointer(&value)) return &value, err @@ -62,7 +62,7 @@ func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { // IoctlGetTermios performs an ioctl on fd with a *Termios. // // The req value is expected to be TCGETS -func IoctlGetTermios(fd int, req uint) (*Termios, error) { +func IoctlGetTermios(fd int, req int) (*Termios, error) { var value Termios if req != TCGETS { return &value, ENOSYS diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 7456d9ddd..be0423e68 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -66,6 +66,7 @@ includes_Darwin=' #include #include #include +#include #include #include #include @@ -203,6 +204,7 @@ struct ltchars { #include #include #include +#include #include #include #include @@ -517,10 +519,11 @@ ccflags="$@" $2 ~ /^LOCK_(SH|EX|NB|UN)$/ || $2 ~ /^LO_(KEY|NAME)_SIZE$/ || $2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ || - $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT)_/ || + $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ || $2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ || $2 ~ /^NFC_.*_(MAX)?SIZE$/ || $2 ~ /^RAW_PAYLOAD_/ || + $2 ~ /^[US]F_/ || $2 ~ /^TP_STATUS_/ || $2 ~ /^FALLOC_/ || $2 ~ /^ICMPV?6?_(FILTER|SEC)/ || diff --git a/vendor/golang.org/x/sys/unix/syscall_aix.go b/vendor/golang.org/x/sys/unix/syscall_aix.go index d9f5544cc..c406ae00f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix.go @@ -408,8 +408,8 @@ func (w WaitStatus) CoreDump() bool { return w&0x80 == 0x80 } func (w WaitStatus) TrapCause() int { return -1 } -//sys ioctl(fd int, req uint, arg uintptr) (err error) -//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = ioctl +//sys ioctl(fd int, req int, arg uintptr) (err error) +//sys ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) = ioctl // fcntl must never be called with cmd=F_DUP2FD because it doesn't work on AIX // There is no way to create a custom fcntl and to keep //sys fcntl easily, diff --git a/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go index e92a0be16..f2871fa95 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go @@ -8,7 +8,6 @@ package unix //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = getrlimit64 -//sysnb Setrlimit(resource int, rlim *Rlimit) (err error) = setrlimit64 //sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek64 //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go index 16eed1709..75718ec0f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go @@ -8,7 +8,6 @@ package unix //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) -//sysnb Setrlimit(resource int, rlim *Rlimit) (err error) //sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) = mmap64 diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 7064d6eba..206921504 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -613,6 +613,7 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) { //sys Rmdir(path string) (err error) //sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) +//sys Setattrlist(path string, attrlist *Attrlist, attrBuf []byte, options int) (err error) //sys Setegid(egid int) (err error) //sysnb Seteuid(euid int) (err error) //sysnb Setgid(gid int) (err error) @@ -622,7 +623,6 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) { //sys Setprivexec(flag int) (err error) //sysnb Setregid(rgid int, egid int) (err error) //sysnb Setreuid(ruid int, euid int) (err error) -//sysnb Setrlimit(which int, lim *Rlimit) (err error) //sysnb Setsid() (pid int, err error) //sysnb Settimeofday(tp *Timeval) (err error) //sysnb Setuid(uid int) (err error) @@ -676,7 +676,6 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) { // Kqueue_from_portset_np // Kqueue_portset // Getattrlist -// Setattrlist // Getdirentriesattr // Searchfs // Delete diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go index 221efc26b..d4ce988e7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go +++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go @@ -326,7 +326,6 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sysnb Setreuid(ruid int, euid int) (err error) //sysnb Setresgid(rgid int, egid int, sgid int) (err error) //sysnb Setresuid(ruid int, euid int, suid int) (err error) -//sysnb Setrlimit(which int, lim *Rlimit) (err error) //sysnb Setsid() (pid int, err error) //sysnb Settimeofday(tp *Timeval) (err error) //sysnb Setuid(uid int) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go index 5bdde03e4..afb10106f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd.go @@ -433,7 +433,6 @@ func Dup3(oldfd, newfd, flags int) error { //sysnb Setreuid(ruid int, euid int) (err error) //sysnb Setresgid(rgid int, egid int, sgid int) (err error) //sysnb Setresuid(ruid int, euid int, suid int) (err error) -//sysnb Setrlimit(which int, lim *Rlimit) (err error) //sysnb Setsid() (pid int, err error) //sysnb Settimeofday(tp *Timeval) (err error) //sysnb Setuid(uid int) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index 973533153..fbaeb5fff 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -1873,7 +1873,6 @@ func Getpgrp() (pid int) { //sys OpenTree(dfd int, fileName string, flags uint) (r int, err error) //sys PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error) //sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT -//sysnb Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64 //sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) //sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6 //sys read(fd int, p []byte) (n int, err error) @@ -1887,6 +1886,15 @@ func Getpgrp() (pid int) { //sysnb Settimeofday(tv *Timeval) (err error) //sys Setns(fd int, nstype int) (err error) +//go:linkname syscall_prlimit syscall.prlimit +func syscall_prlimit(pid, resource int, newlimit, old *syscall.Rlimit) error + +func Prlimit(pid, resource int, newlimit, old *Rlimit) error { + // Just call the syscall version, because as of Go 1.21 + // it will affect starting a new process. + return syscall_prlimit(pid, resource, (*syscall.Rlimit)(newlimit), (*syscall.Rlimit)(old)) +} + // PrctlRetInt performs a prctl operation specified by option and further // optional arguments arg2 through arg5 depending on option. It returns a // non-negative integer that is returned by the prctl syscall. diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_386.go index ff5b5899d..c7d9945ea 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_386.go @@ -97,33 +97,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) { return } -//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT - -func Setrlimit(resource int, rlim *Rlimit) (err error) { - err = Prlimit(0, resource, rlim, nil) - if err != ENOSYS { - return err - } - - rl := rlimit32{} - if rlim.Cur == rlimInf64 { - rl.Cur = rlimInf32 - } else if rlim.Cur < uint64(rlimInf32) { - rl.Cur = uint32(rlim.Cur) - } else { - return EINVAL - } - if rlim.Max == rlimInf64 { - rl.Max = rlimInf32 - } else if rlim.Max < uint64(rlimInf32) { - rl.Max = uint32(rlim.Max) - } else { - return EINVAL - } - - return setrlimit(resource, &rl) -} - func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { newoffset, errno := seek(fd, offset, whence) if errno != 0 { diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go index 9b2703532..5b21fcfd7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go @@ -46,7 +46,6 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys setfsgid(gid int) (prev int, err error) //sys setfsuid(uid int) (prev int, err error) -//sysnb Setrlimit(resource int, rlim *Rlimit) (err error) //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go index 856ad1d63..da2986415 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go @@ -171,33 +171,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) { return } -//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT - -func Setrlimit(resource int, rlim *Rlimit) (err error) { - err = Prlimit(0, resource, rlim, nil) - if err != ENOSYS { - return err - } - - rl := rlimit32{} - if rlim.Cur == rlimInf64 { - rl.Cur = rlimInf32 - } else if rlim.Cur < uint64(rlimInf32) { - rl.Cur = uint32(rlim.Cur) - } else { - return EINVAL - } - if rlim.Max == rlimInf64 { - rl.Max = rlimInf32 - } else if rlim.Max < uint64(rlimInf32) { - rl.Max = uint32(rlim.Max) - } else { - return EINVAL - } - - return setrlimit(resource, &rl) -} - func (r *PtraceRegs) PC() uint64 { return uint64(r.Uregs[15]) } func (r *PtraceRegs) SetPC(pc uint64) { r.Uregs[15] = uint32(pc) } diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go index 6422704bc..a81f5742b 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go @@ -39,7 +39,6 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys setfsgid(gid int) (prev int, err error) //sys setfsuid(uid int) (prev int, err error) -//sysnb setrlimit(resource int, rlim *Rlimit) (err error) //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) @@ -143,15 +142,6 @@ func Getrlimit(resource int, rlim *Rlimit) error { return getrlimit(resource, rlim) } -// Setrlimit prefers the prlimit64 system call. See issue 38604. -func Setrlimit(resource int, rlim *Rlimit) error { - err := Prlimit(0, resource, rlim, nil) - if err != ENOSYS { - return err - } - return setrlimit(resource, rlim) -} - func (r *PtraceRegs) PC() uint64 { return r.Pc } func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc } diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go b/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go index 59dab510e..69d2d7c3d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go @@ -126,11 +126,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) { return } -func Setrlimit(resource int, rlim *Rlimit) (err error) { - err = Prlimit(0, resource, rlim, nil) - return -} - func futimesat(dirfd int, path string, tv *[2]Timeval) (err error) { if tv == nil { return utimensat(dirfd, path, nil, 0) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go index bfef09a39..76d564095 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go @@ -37,7 +37,6 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys setfsgid(gid int) (prev int, err error) //sys setfsuid(uid int) (prev int, err error) -//sysnb Setrlimit(resource int, rlim *Rlimit) (err error) //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) //sys Statfs(path string, buf *Statfs_t) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go index ab3025096..aae7f0ffd 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go @@ -151,33 +151,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) { return } -//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT - -func Setrlimit(resource int, rlim *Rlimit) (err error) { - err = Prlimit(0, resource, rlim, nil) - if err != ENOSYS { - return err - } - - rl := rlimit32{} - if rlim.Cur == rlimInf64 { - rl.Cur = rlimInf32 - } else if rlim.Cur < uint64(rlimInf32) { - rl.Cur = uint32(rlim.Cur) - } else { - return EINVAL - } - if rlim.Max == rlimInf64 { - rl.Max = rlimInf32 - } else if rlim.Max < uint64(rlimInf32) { - rl.Max = uint32(rlim.Max) - } else { - return EINVAL - } - - return setrlimit(resource, &rl) -} - func (r *PtraceRegs) PC() uint64 { return r.Epc } func (r *PtraceRegs) SetPC(pc uint64) { r.Epc = pc } diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go index eac1cf1ac..66eff19a3 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go @@ -159,33 +159,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) { return } -//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT - -func Setrlimit(resource int, rlim *Rlimit) (err error) { - err = Prlimit(0, resource, rlim, nil) - if err != ENOSYS { - return err - } - - rl := rlimit32{} - if rlim.Cur == rlimInf64 { - rl.Cur = rlimInf32 - } else if rlim.Cur < uint64(rlimInf32) { - rl.Cur = uint32(rlim.Cur) - } else { - return EINVAL - } - if rlim.Max == rlimInf64 { - rl.Max = rlimInf32 - } else if rlim.Max < uint64(rlimInf32) { - rl.Max = uint32(rlim.Max) - } else { - return EINVAL - } - - return setrlimit(resource, &rl) -} - func (r *PtraceRegs) PC() uint32 { return r.Nip } func (r *PtraceRegs) SetPC(pc uint32) { r.Nip = pc } diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go index 4df56616b..806aa2574 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go @@ -34,7 +34,6 @@ package unix //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys setfsgid(gid int) (prev int, err error) //sys setfsuid(uid int) (prev int, err error) -//sysnb Setrlimit(resource int, rlim *Rlimit) (err error) //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) //sys Stat(path string, stat *Stat_t) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go index 5f4243dea..35851ef70 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go @@ -38,7 +38,6 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys setfsgid(gid int) (prev int, err error) //sys setfsuid(uid int) (prev int, err error) -//sysnb Setrlimit(resource int, rlim *Rlimit) (err error) //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go index d0a7d4066..2f89e8f5d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go @@ -34,7 +34,6 @@ import ( //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys setfsgid(gid int) (prev int, err error) //sys setfsuid(uid int) (prev int, err error) -//sysnb Setrlimit(resource int, rlim *Rlimit) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) //sys Stat(path string, stat *Stat_t) (err error) //sys Statfs(path string, buf *Statfs_t) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go index f5c793be2..7ca064ae7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go @@ -31,7 +31,6 @@ package unix //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys setfsgid(gid int) (prev int, err error) //sys setfsuid(uid int) (prev int, err error) -//sysnb Setrlimit(resource int, rlim *Rlimit) (err error) //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) //sys Stat(path string, stat *Stat_t) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/vendor/golang.org/x/sys/unix/syscall_netbsd.go index e66865dcc..018d7d478 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd.go @@ -340,7 +340,6 @@ func Statvfs(path string, buf *Statvfs_t) (err error) { //sys Setpriority(which int, who int, prio int) (err error) //sysnb Setregid(rgid int, egid int) (err error) //sysnb Setreuid(ruid int, euid int) (err error) -//sysnb Setrlimit(which int, lim *Rlimit) (err error) //sysnb Setsid() (pid int, err error) //sysnb Settimeofday(tp *Timeval) (err error) //sysnb Setuid(uid int) (err error) @@ -501,7 +500,6 @@ func Statvfs(path string, buf *Statvfs_t) (err error) { // compat_43_osendmsg // compat_43_osethostid // compat_43_osethostname -// compat_43_osetrlimit // compat_43_osigblock // compat_43_osigsetmask // compat_43_osigstack diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go index 5e9de23ae..f9c7a9663 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -294,7 +294,6 @@ func Uname(uname *Utsname) error { //sysnb Setreuid(ruid int, euid int) (err error) //sysnb Setresgid(rgid int, egid int, sgid int) (err error) //sysnb Setresuid(ruid int, euid int, suid int) (err error) -//sysnb Setrlimit(which int, lim *Rlimit) (err error) //sysnb Setrtable(rtable int) (err error) //sysnb Setsid() (pid int, err error) //sysnb Settimeofday(tp *Timeval) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go index d3444b64d..b600a289d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -545,24 +545,24 @@ func Minor(dev uint64) uint32 { * Expose the ioctl function */ -//sys ioctlRet(fd int, req uint, arg uintptr) (ret int, err error) = libc.ioctl -//sys ioctlPtrRet(fd int, req uint, arg unsafe.Pointer) (ret int, err error) = libc.ioctl +//sys ioctlRet(fd int, req int, arg uintptr) (ret int, err error) = libc.ioctl +//sys ioctlPtrRet(fd int, req int, arg unsafe.Pointer) (ret int, err error) = libc.ioctl -func ioctl(fd int, req uint, arg uintptr) (err error) { +func ioctl(fd int, req int, arg uintptr) (err error) { _, err = ioctlRet(fd, req, arg) return err } -func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { +func ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) { _, err = ioctlPtrRet(fd, req, arg) return err } -func IoctlSetTermio(fd int, req uint, value *Termio) error { +func IoctlSetTermio(fd int, req int, value *Termio) error { return ioctlPtr(fd, req, unsafe.Pointer(value)) } -func IoctlGetTermio(fd int, req uint) (*Termio, error) { +func IoctlGetTermio(fd int, req int) (*Termio, error) { var value Termio err := ioctlPtr(fd, req, unsafe.Pointer(&value)) return &value, err @@ -665,7 +665,6 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Setpriority(which int, who int, prio int) (err error) //sysnb Setregid(rgid int, egid int) (err error) //sysnb Setreuid(ruid int, euid int) (err error) -//sysnb Setrlimit(which int, lim *Rlimit) (err error) //sysnb Setsid() (pid int, err error) //sysnb Setuid(uid int) (err error) //sys Shutdown(s int, how int) (err error) = libsocket.shutdown @@ -1080,11 +1079,11 @@ func Getmsg(fd int, cl []byte, data []byte) (retCl []byte, retData []byte, flags return retCl, retData, flags, nil } -func IoctlSetIntRetInt(fd int, req uint, arg int) (int, error) { +func IoctlSetIntRetInt(fd int, req int, arg int) (int, error) { return ioctlRet(fd, req, uintptr(arg)) } -func IoctlSetString(fd int, req uint, val string) error { +func IoctlSetString(fd int, req int, val string) error { bs := make([]byte, len(val)+1) copy(bs[:len(bs)-1], val) err := ioctlPtr(fd, req, unsafe.Pointer(&bs[0])) @@ -1120,7 +1119,7 @@ func (l *Lifreq) GetLifruUint() uint { return *(*uint)(unsafe.Pointer(&l.Lifru[0])) } -func IoctlLifreq(fd int, req uint, l *Lifreq) error { +func IoctlLifreq(fd int, req int, l *Lifreq) error { return ioctlPtr(fd, req, unsafe.Pointer(l)) } @@ -1131,6 +1130,6 @@ func (s *Strioctl) SetInt(i int) { s.Dp = (*int8)(unsafe.Pointer(&i)) } -func IoctlSetStrioctlRetInt(fd int, req uint, s *Strioctl) (int, error) { +func IoctlSetStrioctlRetInt(fd int, req int, s *Strioctl) (int, error) { return ioctlPtrRet(fd, req, unsafe.Pointer(s)) } diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go index 00f0aa375..8e48c29ec 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -587,3 +587,10 @@ func emptyIovecs(iov []Iovec) bool { } return true } + +// Setrlimit sets a resource limit. +func Setrlimit(resource int, rlim *Rlimit) error { + // Just call the syscall version, because as of Go 1.21 + // it will affect starting a new process. + return syscall.Setrlimit(resource, (*syscall.Rlimit)(rlim)) +} diff --git a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go index b295497ae..d3d49ec3e 100644 --- a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go @@ -212,8 +212,8 @@ func (cmsg *Cmsghdr) SetLen(length int) { //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = SYS___SENDMSG_A //sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) = SYS_MMAP //sys munmap(addr uintptr, length uintptr) (err error) = SYS_MUNMAP -//sys ioctl(fd int, req uint, arg uintptr) (err error) = SYS_IOCTL -//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL +//sys ioctl(fd int, req int, arg uintptr) (err error) = SYS_IOCTL +//sys ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) = SYS_IOCTL //sys Access(path string, mode uint32) (err error) = SYS___ACCESS_A //sys Chdir(path string) (err error) = SYS___CHDIR_A diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go index 476a1c7e7..143007627 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go @@ -1270,6 +1270,16 @@ const ( SEEK_END = 0x2 SEEK_HOLE = 0x3 SEEK_SET = 0x0 + SF_APPEND = 0x40000 + SF_ARCHIVED = 0x10000 + SF_DATALESS = 0x40000000 + SF_FIRMLINK = 0x800000 + SF_IMMUTABLE = 0x20000 + SF_NOUNLINK = 0x100000 + SF_RESTRICTED = 0x80000 + SF_SETTABLE = 0x3fff0000 + SF_SUPPORTED = 0x9f0000 + SF_SYNTHETIC = 0xc0000000 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1543,6 +1553,15 @@ const ( TIOCTIMESTAMP = 0x40107459 TIOCUCNTL = 0x80047466 TOSTOP = 0x400000 + UF_APPEND = 0x4 + UF_COMPRESSED = 0x20 + UF_DATAVAULT = 0x80 + UF_HIDDEN = 0x8000 + UF_IMMUTABLE = 0x2 + UF_NODUMP = 0x1 + UF_OPAQUE = 0x8 + UF_SETTABLE = 0xffff + UF_TRACKED = 0x40 VDISCARD = 0xf VDSUSP = 0xb VEOF = 0x0 diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go index e36f5178d..ab044a742 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go @@ -1270,6 +1270,16 @@ const ( SEEK_END = 0x2 SEEK_HOLE = 0x3 SEEK_SET = 0x0 + SF_APPEND = 0x40000 + SF_ARCHIVED = 0x10000 + SF_DATALESS = 0x40000000 + SF_FIRMLINK = 0x800000 + SF_IMMUTABLE = 0x20000 + SF_NOUNLINK = 0x100000 + SF_RESTRICTED = 0x80000 + SF_SETTABLE = 0x3fff0000 + SF_SUPPORTED = 0x9f0000 + SF_SYNTHETIC = 0xc0000000 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1543,6 +1553,15 @@ const ( TIOCTIMESTAMP = 0x40107459 TIOCUCNTL = 0x80047466 TOSTOP = 0x400000 + UF_APPEND = 0x4 + UF_COMPRESSED = 0x20 + UF_DATAVAULT = 0x80 + UF_HIDDEN = 0x8000 + UF_IMMUTABLE = 0x2 + UF_NODUMP = 0x1 + UF_OPAQUE = 0x8 + UF_SETTABLE = 0xffff + UF_TRACKED = 0x40 VDISCARD = 0xf VDSUSP = 0xb VEOF = 0x0 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index 398c37e52..de936b677 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -2967,6 +2967,7 @@ const ( SOL_TCP = 0x6 SOL_TIPC = 0x10f SOL_TLS = 0x11a + SOL_UDP = 0x11 SOL_X25 = 0x106 SOL_XDP = 0x11b SOMAXCONN = 0x1000 @@ -3251,6 +3252,19 @@ const ( TRACEFS_MAGIC = 0x74726163 TS_COMM_LEN = 0x20 UDF_SUPER_MAGIC = 0x15013346 + UDP_CORK = 0x1 + UDP_ENCAP = 0x64 + UDP_ENCAP_ESPINUDP = 0x2 + UDP_ENCAP_ESPINUDP_NON_IKE = 0x1 + UDP_ENCAP_GTP0 = 0x4 + UDP_ENCAP_GTP1U = 0x5 + UDP_ENCAP_L2TPINUDP = 0x3 + UDP_GRO = 0x68 + UDP_NO_CHECK6_RX = 0x66 + UDP_NO_CHECK6_TX = 0x65 + UDP_SEGMENT = 0x67 + UDP_V4_FLOW = 0x2 + UDP_V6_FLOW = 0x6 UMOUNT_NOFOLLOW = 0x8 USBDEVICE_SUPER_MAGIC = 0x9fa2 UTIME_NOW = 0x3fffffff diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go index ef9dcd1be..9a257219d 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go @@ -124,7 +124,6 @@ int utime(uintptr_t, uintptr_t); unsigned long long getsystemcfg(int); int umount(uintptr_t); int getrlimit64(int, uintptr_t); -int setrlimit64(int, uintptr_t); long long lseek64(int, long long, int); uintptr_t mmap(uintptr_t, uintptr_t, int, int, int, long long); @@ -213,7 +212,7 @@ func wait4(pid Pid_t, status *_C_int, options int, rusage *Rusage) (wpid Pid_t, // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ioctl(fd int, req uint, arg uintptr) (err error) { +func ioctl(fd int, req int, arg uintptr) (err error) { r0, er := C.ioctl(C.int(fd), C.int(req), C.uintptr_t(arg)) if r0 == -1 && er != nil { err = er @@ -223,7 +222,7 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { +func ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) { r0, er := C.ioctl(C.int(fd), C.int(req), C.uintptr_t(uintptr(arg))) if r0 == -1 && er != nil { err = er @@ -1464,16 +1463,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(resource int, rlim *Rlimit) (err error) { - r0, er := C.setrlimit64(C.int(resource), C.uintptr_t(uintptr(unsafe.Pointer(rlim)))) - if r0 == -1 && er != nil { - err = er - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, er := C.lseek64(C.int(fd), C.longlong(offset), C.int(whence)) off = int64(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go index f86a94592..6de80c20c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go @@ -93,8 +93,8 @@ func wait4(pid Pid_t, status *_C_int, options int, rusage *Rusage) (wpid Pid_t, // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, e1 := callioctl(fd, int(req), arg) +func ioctl(fd int, req int, arg uintptr) (err error) { + _, e1 := callioctl(fd, req, arg) if e1 != 0 { err = errnoErr(e1) } @@ -103,8 +103,8 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { - _, e1 := callioctl_ptr(fd, int(req), arg) +func ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) { + _, e1 := callioctl_ptr(fd, req, arg) if e1 != 0 { err = errnoErr(e1) } @@ -1422,16 +1422,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, e1 := callsetrlimit(resource, uintptr(unsafe.Pointer(rlim))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, e1 := calllseek(fd, offset, whence) off = int64(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go index d32a84cae..c4d50ae50 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go @@ -124,7 +124,6 @@ import ( //go:cgo_import_dynamic libc_getsystemcfg getsystemcfg "libc.a/shr_64.o" //go:cgo_import_dynamic libc_umount umount "libc.a/shr_64.o" //go:cgo_import_dynamic libc_getrlimit getrlimit "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.a/shr_64.o" //go:cgo_import_dynamic libc_lseek lseek "libc.a/shr_64.o" //go:cgo_import_dynamic libc_mmap64 mmap64 "libc.a/shr_64.o" @@ -242,7 +241,6 @@ import ( //go:linkname libc_getsystemcfg libc_getsystemcfg //go:linkname libc_umount libc_umount //go:linkname libc_getrlimit libc_getrlimit -//go:linkname libc_setrlimit libc_setrlimit //go:linkname libc_lseek libc_lseek //go:linkname libc_mmap64 libc_mmap64 @@ -363,7 +361,6 @@ var ( libc_getsystemcfg, libc_umount, libc_getrlimit, - libc_setrlimit, libc_lseek, libc_mmap64 syscallFunc ) @@ -1179,13 +1176,6 @@ func callgetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func callsetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_setrlimit)), 2, uintptr(resource), rlim, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func calllseek(fd int, offset int64, whence int) (r1 uintptr, e1 Errno) { r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_lseek)), 3, uintptr(fd), uintptr(offset), uintptr(whence), 0, 0, 0) return diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go index d7d8baf81..6903d3b09 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go @@ -123,7 +123,6 @@ int utime(uintptr_t, uintptr_t); unsigned long long getsystemcfg(int); int umount(uintptr_t); int getrlimit(int, uintptr_t); -int setrlimit(int, uintptr_t); long long lseek(int, long long, int); uintptr_t mmap64(uintptr_t, uintptr_t, int, int, int, long long); @@ -131,6 +130,7 @@ uintptr_t mmap64(uintptr_t, uintptr_t, int, int, int, long long); import "C" import ( "syscall" + "unsafe" ) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1055,14 +1055,6 @@ func callgetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func callsetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.setrlimit(C.int(resource), C.uintptr_t(rlim))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func calllseek(fd int, offset int64, whence int) (r1 uintptr, e1 Errno) { r1 = uintptr(C.lseek(C.int(fd), C.longlong(offset), C.int(whence))) e1 = syscall.GetErrno() diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index a29ffdd56..4037ccf7a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -1992,6 +1992,31 @@ var libc_select_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Setattrlist(path string, attrlist *Attrlist, attrBuf []byte, options int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(attrBuf) > 0 { + _p1 = unsafe.Pointer(&attrBuf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall6(libc_setattrlist_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(attrlist)), uintptr(_p1), uintptr(len(attrBuf)), uintptr(options), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setattrlist_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Setegid(egid int) (err error) { _, _, e1 := syscall_syscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0) if e1 != 0 { @@ -2123,20 +2148,6 @@ var libc_setreuid_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_setrlimit_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s index 95fe4c0eb..4baaed0bc 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s @@ -705,6 +705,11 @@ TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8 DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB) +TEXT libc_setattrlist_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setattrlist(SB) +GLOBL ·libc_setattrlist_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setattrlist_trampoline_addr(SB)/8, $libc_setattrlist_trampoline<>(SB) + TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setegid(SB) @@ -759,12 +764,6 @@ TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB) -TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) - -GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 -DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) - TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setsid(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index 2fd4590bb..51d6f3fb2 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -1992,6 +1992,31 @@ var libc_select_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Setattrlist(path string, attrlist *Attrlist, attrBuf []byte, options int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(attrBuf) > 0 { + _p1 = unsafe.Pointer(&attrBuf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall6(libc_setattrlist_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(attrlist)), uintptr(_p1), uintptr(len(attrBuf)), uintptr(options), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_setattrlist_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Setegid(egid int) (err error) { _, _, e1 := syscall_syscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0) if e1 != 0 { @@ -2123,20 +2148,6 @@ var libc_setreuid_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_setrlimit_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s index efa5b4c98..c3b82c037 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s @@ -705,6 +705,11 @@ TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8 DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB) +TEXT libc_setattrlist_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_setattrlist(SB) +GLOBL ·libc_setattrlist_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setattrlist_trampoline_addr(SB)/8, $libc_setattrlist_trampoline<>(SB) + TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setegid(SB) @@ -759,12 +764,6 @@ TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB) -TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) - -GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 -DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) - TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setsid(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go index 3b8513470..0eabac7ad 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go @@ -1410,16 +1410,6 @@ func Setresuid(ruid int, euid int, suid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go index 112906562..ee313eb00 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go @@ -1645,16 +1645,6 @@ func Setresuid(ruid int, euid int, suid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go index 55f5abfe5..4c986e448 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go @@ -1645,16 +1645,6 @@ func Setresuid(ruid int, euid int, suid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go index d39651c2b..555216944 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go @@ -1645,16 +1645,6 @@ func Setresuid(ruid int, euid int, suid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go index ddb740868..67a226fbf 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go @@ -1645,16 +1645,6 @@ func Setresuid(ruid int, euid int, suid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go index 09a53a616..f0b9ddaaa 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go @@ -1645,16 +1645,6 @@ func Setresuid(ruid int, euid int, suid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go index 430cb24de..da63d9d78 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -1346,16 +1346,6 @@ func PivotRoot(newroot string, putold string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) { - _, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) { _, _, e1 := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go index c81b0ad47..07b549cc2 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go @@ -411,16 +411,6 @@ func getrlimit(resource int, rlim *rlimit32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func setrlimit(resource int, rlim *rlimit32) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func futimesat(dirfd int, path string, times *[2]Timeval) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go index 2206bce7f..5f481bf83 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go @@ -334,16 +334,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go index edf6b39f1..824cd52c7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go @@ -578,16 +578,6 @@ func getrlimit(resource int, rlim *rlimit32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func setrlimit(resource int, rlim *rlimit32) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func armSyncFileRange(fd int, flags int, off int64, n int64) (err error) { _, _, e1 := Syscall6(SYS_ARM_SYNC_FILE_RANGE, uintptr(fd), uintptr(flags), uintptr(off), uintptr(off>>32), uintptr(n), uintptr(n>>32)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go index 190609f21..e77aecfe9 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go @@ -289,16 +289,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go index 5f984cbb1..961a3afb7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go @@ -644,16 +644,6 @@ func getrlimit(resource int, rlim *rlimit32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func setrlimit(resource int, rlim *rlimit32) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Alarm(seconds uint) (remaining uint, err error) { r0, _, e1 := Syscall(SYS_ALARM, uintptr(seconds), 0, 0) remaining = uint(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go index 46fc380a4..ed05005e9 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go @@ -278,16 +278,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go index cbd0d4dad..d365b718f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go @@ -278,16 +278,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go index 0c13d15f0..c3f1b8bbd 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go @@ -644,16 +644,6 @@ func getrlimit(resource int, rlim *rlimit32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func setrlimit(resource int, rlim *rlimit32) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Alarm(seconds uint) (remaining uint, err error) { r0, _, e1 := Syscall(SYS_ALARM, uintptr(seconds), 0, 0) remaining = uint(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go index e01432aed..a6574cf98 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go @@ -624,16 +624,6 @@ func getrlimit(resource int, rlim *rlimit32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func setrlimit(resource int, rlim *rlimit32) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func syncFileRange2(fd int, flags int, off int64, n int64) (err error) { _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE2, uintptr(fd), uintptr(flags), uintptr(off>>32), uintptr(off), uintptr(n>>32), uintptr(n)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go index 13c7ee7ba..f40990264 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go @@ -349,16 +349,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go index 02d0c0fd6..9dfcc2997 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go @@ -349,16 +349,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go index 9fee3b1d2..0b2923958 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go @@ -269,16 +269,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go index 647bbfecd..6cde32237 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go @@ -319,16 +319,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) { r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) n = int64(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go index ada057f89..5253d65bf 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go @@ -329,16 +329,6 @@ func setfsuid(uid int) (prev int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(resource int, rlim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go index 8e1d9c8f6..cdb2af5ae 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go @@ -1607,16 +1607,6 @@ func Setreuid(ruid int, euid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go index 21c695040..9d25f76b0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go @@ -1607,16 +1607,6 @@ func Setreuid(ruid int, euid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go index 298168f90..d3f803516 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go @@ -1607,16 +1607,6 @@ func Setreuid(ruid int, euid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go index 68b8bd492..887188a52 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go @@ -1607,16 +1607,6 @@ func Setreuid(ruid int, euid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go index 0b0f910e1..6699a783e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go @@ -1894,20 +1894,6 @@ var libc_setresuid_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_setrlimit_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrtable(rtable int) (err error) { _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s index 087444250..04f0de34b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s @@ -573,11 +573,6 @@ TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $4 DATA ·libc_setresuid_trampoline_addr(SB)/4, $libc_setresuid_trampoline<>(SB) -TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $4 -DATA ·libc_setrlimit_trampoline_addr(SB)/4, $libc_setrlimit_trampoline<>(SB) - TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setrtable(SB) GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $4 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go index 48ff5de75..1e775fe05 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go @@ -1894,20 +1894,6 @@ var libc_setresuid_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_setrlimit_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrtable(rtable int) (err error) { _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s index 5782cd108..27b6f4df7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s @@ -573,11 +573,6 @@ TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setresuid_trampoline_addr(SB)/8, $libc_setresuid_trampoline<>(SB) -TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 -DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) - TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setrtable(SB) GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go index 2452a641d..7f6427899 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go @@ -1894,20 +1894,6 @@ var libc_setresuid_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_setrlimit_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrtable(rtable int) (err error) { _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s index cf310420c..b797045fd 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s @@ -573,11 +573,6 @@ TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $4 DATA ·libc_setresuid_trampoline_addr(SB)/4, $libc_setresuid_trampoline<>(SB) -TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $4 -DATA ·libc_setrlimit_trampoline_addr(SB)/4, $libc_setrlimit_trampoline<>(SB) - TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setrtable(SB) GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $4 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go index 5e35600a6..756ef7b17 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go @@ -1894,20 +1894,6 @@ var libc_setresuid_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_setrlimit_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrtable(rtable int) (err error) { _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s index 484bb42e0..a87126622 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s @@ -573,11 +573,6 @@ TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setresuid_trampoline_addr(SB)/8, $libc_setresuid_trampoline<>(SB) -TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 -DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) - TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setrtable(SB) GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go index b04cef1a1..7bc2e24eb 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go @@ -1894,20 +1894,6 @@ var libc_setresuid_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_setrlimit_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrtable(rtable int) (err error) { _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s index 55af27263..05d4bffd7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s @@ -573,11 +573,6 @@ TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setresuid_trampoline_addr(SB)/8, $libc_setresuid_trampoline<>(SB) -TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 -DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) - TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setrtable(SB) GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go index 47a07ee0c..739be6217 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go @@ -1894,20 +1894,6 @@ var libc_setresuid_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_setrlimit_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrtable(rtable int) (err error) { _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s index 4028255b0..74a25f8d6 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s @@ -687,12 +687,6 @@ TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setresuid_trampoline_addr(SB)/8, $libc_setresuid_trampoline<>(SB) -TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 - CALL libc_setrlimit(SB) - RET -GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 -DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) - TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 CALL libc_setrtable(SB) RET diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go index 573378fdb..7d95a1978 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go @@ -1894,20 +1894,6 @@ var libc_setresuid_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -var libc_setrlimit_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setrtable(rtable int) (err error) { _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s index e1fbd4dfa..990be2457 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s @@ -573,11 +573,6 @@ TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setresuid_trampoline_addr(SB)/8, $libc_setresuid_trampoline<>(SB) -TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 -DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) - TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setrtable(SB) GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go index 4873a1e5d..609d1c598 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go @@ -110,7 +110,6 @@ import ( //go:cgo_import_dynamic libc_setpriority setpriority "libc.so" //go:cgo_import_dynamic libc_setregid setregid "libc.so" //go:cgo_import_dynamic libc_setreuid setreuid "libc.so" -//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" //go:cgo_import_dynamic libc_setsid setsid "libc.so" //go:cgo_import_dynamic libc_setuid setuid "libc.so" //go:cgo_import_dynamic libc_shutdown shutdown "libsocket.so" @@ -250,7 +249,6 @@ import ( //go:linkname procSetpriority libc_setpriority //go:linkname procSetregid libc_setregid //go:linkname procSetreuid libc_setreuid -//go:linkname procSetrlimit libc_setrlimit //go:linkname procSetsid libc_setsid //go:linkname procSetuid libc_setuid //go:linkname procshutdown libc_shutdown @@ -391,7 +389,6 @@ var ( procSetpriority, procSetregid, procSetreuid, - procSetrlimit, procSetsid, procSetuid, procshutdown, @@ -646,7 +643,7 @@ func __minor(version int, dev uint64) (val uint) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ioctlRet(fd int, req uint, arg uintptr) (ret int, err error) { +func ioctlRet(fd int, req int, arg uintptr) (ret int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0) ret = int(r0) if e1 != 0 { @@ -657,7 +654,7 @@ func ioctlRet(fd int, req uint, arg uintptr) (ret int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ioctlPtrRet(fd int, req uint, arg unsafe.Pointer) (ret int, err error) { +func ioctlPtrRet(fd int, req int, arg unsafe.Pointer) (ret int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0) ret = int(r0) if e1 != 0 { @@ -1650,16 +1647,6 @@ func Setreuid(ruid int, euid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetrlimit)), 2, uintptr(which), uintptr(unsafe.Pointer(lim)), 0, 0, 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setsid() (pid int, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetsid)), 0, 0, 0, 0, 0, 0, 0) pid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go index 07bfe2ef9..c31681743 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go @@ -257,7 +257,7 @@ func munmap(addr uintptr, length uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ioctl(fd int, req uint, arg uintptr) (err error) { +func ioctl(fd int, req int, arg uintptr) (err error) { _, _, e1 := syscall_syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) @@ -267,7 +267,7 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { +func ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) { _, _, e1 := syscall_syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index e2a64f099..690cefc3d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -151,6 +151,16 @@ type Dirent struct { _ [3]byte } +type Attrlist struct { + Bitmapcount uint16 + Reserved uint16 + Commonattr uint32 + Volattr uint32 + Dirattr uint32 + Fileattr uint32 + Forkattr uint32 +} + const ( PathMax = 0x400 ) @@ -610,6 +620,7 @@ const ( AT_REMOVEDIR = 0x80 AT_SYMLINK_FOLLOW = 0x40 AT_SYMLINK_NOFOLLOW = 0x20 + AT_EACCESS = 0x10 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go index 34aa77521..5bffc10ea 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go @@ -151,6 +151,16 @@ type Dirent struct { _ [3]byte } +type Attrlist struct { + Bitmapcount uint16 + Reserved uint16 + Commonattr uint32 + Volattr uint32 + Dirattr uint32 + Fileattr uint32 + Forkattr uint32 +} + const ( PathMax = 0x400 ) @@ -610,6 +620,7 @@ const ( AT_REMOVEDIR = 0x80 AT_SYMLINK_FOLLOW = 0x40 AT_SYMLINK_NOFOLLOW = 0x20 + AT_EACCESS = 0x10 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/windows/env_windows.go b/vendor/golang.org/x/sys/windows/env_windows.go index 92ac05ff4..b8ad19250 100644 --- a/vendor/golang.org/x/sys/windows/env_windows.go +++ b/vendor/golang.org/x/sys/windows/env_windows.go @@ -37,14 +37,14 @@ func (token Token) Environ(inheritExisting bool) (env []string, err error) { return nil, err } defer DestroyEnvironmentBlock(block) - blockp := uintptr(unsafe.Pointer(block)) + blockp := unsafe.Pointer(block) for { - entry := UTF16PtrToString((*uint16)(unsafe.Pointer(blockp))) + entry := UTF16PtrToString((*uint16)(blockp)) if len(entry) == 0 { break } env = append(env, entry) - blockp += 2 * (uintptr(len(entry)) + 1) + blockp = unsafe.Add(blockp, 2*(len(entry)+1)) } return env, nil } diff --git a/vendor/golang.org/x/sys/windows/exec_windows.go b/vendor/golang.org/x/sys/windows/exec_windows.go index 75980fd44..a52e0331d 100644 --- a/vendor/golang.org/x/sys/windows/exec_windows.go +++ b/vendor/golang.org/x/sys/windows/exec_windows.go @@ -95,12 +95,17 @@ func ComposeCommandLine(args []string) string { // DecomposeCommandLine breaks apart its argument command line into unescaped parts using CommandLineToArgv, // as gathered from GetCommandLine, QUERY_SERVICE_CONFIG's BinaryPathName argument, or elsewhere that // command lines are passed around. +// DecomposeCommandLine returns error if commandLine contains NUL. func DecomposeCommandLine(commandLine string) ([]string, error) { if len(commandLine) == 0 { return []string{}, nil } + utf16CommandLine, err := UTF16FromString(commandLine) + if err != nil { + return nil, errorspkg.New("string with NUL passed to DecomposeCommandLine") + } var argc int32 - argv, err := CommandLineToArgv(StringToUTF16Ptr(commandLine), &argc) + argv, err := CommandLineToArgv(&utf16CommandLine[0], &argc) if err != nil { return nil, err } diff --git a/vendor/golang.org/x/sys/windows/service.go b/vendor/golang.org/x/sys/windows/service.go index f8deca839..c964b6848 100644 --- a/vendor/golang.org/x/sys/windows/service.go +++ b/vendor/golang.org/x/sys/windows/service.go @@ -141,6 +141,12 @@ const ( SERVICE_DYNAMIC_INFORMATION_LEVEL_START_REASON = 1 ) +type ENUM_SERVICE_STATUS struct { + ServiceName *uint16 + DisplayName *uint16 + ServiceStatus SERVICE_STATUS +} + type SERVICE_STATUS struct { ServiceType uint32 CurrentState uint32 @@ -245,3 +251,4 @@ type QUERY_SERVICE_LOCK_STATUS struct { //sys UnsubscribeServiceChangeNotifications(subscription uintptr) = sechost.UnsubscribeServiceChangeNotifications? //sys RegisterServiceCtrlHandlerEx(serviceName *uint16, handlerProc uintptr, context uintptr) (handle Handle, err error) = advapi32.RegisterServiceCtrlHandlerExW //sys QueryServiceDynamicInformation(service Handle, infoLevel uint32, dynamicInfo unsafe.Pointer) (err error) = advapi32.QueryServiceDynamicInformation? +//sys EnumDependentServices(service Handle, activityState uint32, services *ENUM_SERVICE_STATUS, buffSize uint32, bytesNeeded *uint32, servicesReturned *uint32) (err error) = advapi32.EnumDependentServicesW diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index 857acf103..88e62a638 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -2220,19 +2220,23 @@ type JOBOBJECT_BASIC_UI_RESTRICTIONS struct { } const ( - // JobObjectInformationClass + // JobObjectInformationClass for QueryInformationJobObject and SetInformationJobObject JobObjectAssociateCompletionPortInformation = 7 + JobObjectBasicAccountingInformation = 1 + JobObjectBasicAndIoAccountingInformation = 8 JobObjectBasicLimitInformation = 2 + JobObjectBasicProcessIdList = 3 JobObjectBasicUIRestrictions = 4 JobObjectCpuRateControlInformation = 15 JobObjectEndOfJobTimeInformation = 6 JobObjectExtendedLimitInformation = 9 JobObjectGroupInformation = 11 JobObjectGroupInformationEx = 14 - JobObjectLimitViolationInformation2 = 35 + JobObjectLimitViolationInformation = 13 + JobObjectLimitViolationInformation2 = 34 JobObjectNetRateControlInformation = 32 JobObjectNotificationLimitInformation = 12 - JobObjectNotificationLimitInformation2 = 34 + JobObjectNotificationLimitInformation2 = 33 JobObjectSecurityLimitInformation = 5 ) diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index 6d2a26853..a81ea2c70 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -86,6 +86,7 @@ var ( procDeleteService = modadvapi32.NewProc("DeleteService") procDeregisterEventSource = modadvapi32.NewProc("DeregisterEventSource") procDuplicateTokenEx = modadvapi32.NewProc("DuplicateTokenEx") + procEnumDependentServicesW = modadvapi32.NewProc("EnumDependentServicesW") procEnumServicesStatusExW = modadvapi32.NewProc("EnumServicesStatusExW") procEqualSid = modadvapi32.NewProc("EqualSid") procFreeSid = modadvapi32.NewProc("FreeSid") @@ -734,6 +735,14 @@ func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes return } +func EnumDependentServices(service Handle, activityState uint32, services *ENUM_SERVICE_STATUS, buffSize uint32, bytesNeeded *uint32, servicesReturned *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procEnumDependentServicesW.Addr(), 6, uintptr(service), uintptr(activityState), uintptr(unsafe.Pointer(services)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) { r1, _, e1 := syscall.Syscall12(procEnumServicesStatusExW.Addr(), 10, uintptr(mgr), uintptr(infoLevel), uintptr(serviceType), uintptr(serviceState), uintptr(unsafe.Pointer(services)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned)), uintptr(unsafe.Pointer(resumeHandle)), uintptr(unsafe.Pointer(groupName)), 0, 0) if r1 == 0 { diff --git a/vendor/modules.txt b/vendor/modules.txt index 2805e199e..bfeb52b7e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -468,7 +468,7 @@ golang.org/x/crypto/salsa20/salsa ## explicit; go 1.20 golang.org/x/exp/constraints golang.org/x/exp/slices -# golang.org/x/net v0.8.0 +# golang.org/x/net v0.10.0 ## explicit; go 1.17 golang.org/x/net/context golang.org/x/net/context/ctxhttp @@ -486,10 +486,10 @@ golang.org/x/net/websocket ## explicit; go 1.11 golang.org/x/oauth2 golang.org/x/oauth2/internal -# golang.org/x/sync v0.1.0 +# golang.org/x/sync v0.2.0 ## explicit golang.org/x/sync/singleflight -# golang.org/x/sys v0.6.0 +# golang.org/x/sys v0.8.0 ## explicit; go 1.17 golang.org/x/sys/cpu golang.org/x/sys/internal/unsafeheader @@ -497,10 +497,10 @@ golang.org/x/sys/plan9 golang.org/x/sys/unix golang.org/x/sys/windows golang.org/x/sys/windows/registry -# golang.org/x/term v0.6.0 +# golang.org/x/term v0.8.0 ## explicit; go 1.17 golang.org/x/term -# golang.org/x/text v0.8.0 +# golang.org/x/text v0.9.0 ## explicit; go 1.17 golang.org/x/text/encoding golang.org/x/text/encoding/charmap @@ -526,7 +526,7 @@ golang.org/x/text/width # golang.org/x/time v0.3.0 ## explicit golang.org/x/time/rate -# golang.org/x/tools v0.7.0 +# golang.org/x/tools v0.9.1 ## explicit; go 1.18 golang.org/x/tools/go/ast/inspector golang.org/x/tools/internal/typeparams