diff --git a/go.mod b/go.mod
index 8c828d76..69aae506 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
module github.com/cloudfoundry/stembuild
-go 1.18
+go 1.19
require (
github.com/concourse/pool-resource v1.1.1
@@ -10,27 +10,27 @@ require (
github.com/google/uuid v1.3.0
github.com/masterzen/winrm v0.0.0-20220917170901-b07f6cb0598d
github.com/maxbrunsfeld/counterfeiter/v6 v6.5.0
- github.com/onsi/ginkgo/v2 v2.5.2-0.20221209042256-2165648f7697
- github.com/onsi/gomega v1.24.1
+ github.com/onsi/ginkgo/v2 v2.8.3
+ github.com/onsi/gomega v1.27.1
github.com/packer-community/winrmcp v0.0.0-20221126162354-6e900dd2c68f
github.com/pkg/errors v0.9.1
- github.com/vmware/govmomi v0.29.0
- golang.org/x/sys v0.3.0
+ github.com/vmware/govmomi v0.30.2
+ golang.org/x/sys v0.5.0
)
require (
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6 // indirect
- github.com/a8m/tree v0.0.0-20210414114729-ce3525c5c2ef // indirect
+ github.com/a8m/tree v0.0.0-20230208161321-36ae24ddad15 // indirect
github.com/dougm/pretty v0.0.0-20171025230240-2ee9d7453c02 // indirect
github.com/dylanmei/iso8601 v0.1.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
- github.com/gofrs/uuid v4.3.1+incompatible // indirect
+ github.com/gofrs/uuid v4.4.0+incompatible // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
- github.com/google/pprof v0.0.0-20221203041831-ce31453925ec // indirect
+ github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
@@ -44,11 +44,11 @@ require (
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/rogpeppe/go-internal v1.6.1 // indirect
- golang.org/x/crypto v0.3.0 // indirect
- golang.org/x/mod v0.7.0 // indirect
- golang.org/x/net v0.3.0 // indirect
- golang.org/x/text v0.5.0 // indirect
- golang.org/x/tools v0.4.0 // indirect
+ golang.org/x/crypto v0.6.0 // indirect
+ golang.org/x/mod v0.8.0 // indirect
+ golang.org/x/net v0.7.0 // indirect
+ golang.org/x/text v0.7.0 // indirect
+ golang.org/x/tools v0.6.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
diff --git a/go.sum b/go.sum
index 7fe2ecbe..f181c53a 100644
--- a/go.sum
+++ b/go.sum
@@ -3,8 +3,8 @@ github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 h1:mFRzDkZVAjdal+
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=
github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6 h1:w0E0fgc1YafGEh5cROhlROMWXiNoZqApk2PDN0M1+Ns=
github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4=
-github.com/a8m/tree v0.0.0-20210414114729-ce3525c5c2ef h1:CEImiMYHUtgFAgG8UMV6Mk4Ld+IgF39eBbhoehcjXEg=
-github.com/a8m/tree v0.0.0-20210414114729-ce3525c5c2ef/go.mod h1:FSdwKX97koS5efgm8WevNf7XS3PqtyFkKDDXrz778cg=
+github.com/a8m/tree v0.0.0-20230208161321-36ae24ddad15 h1:t3qDzTv8T15tVVhJHHgY7hX5jiIz67xE2SxWQ2ehjH4=
+github.com/a8m/tree v0.0.0-20230208161321-36ae24ddad15/go.mod h1:j5astEcUkZQX8lK+KKlQ3NRQ50f4EE8ZjyZpCz3mrH4=
github.com/concourse/pool-resource v1.1.1 h1:c1G+A4ncmdCr5DWDSdhg9wRaYBLn7cX8e5nxvCNXLYw=
github.com/concourse/pool-resource v1.1.1/go.mod h1:g6Q2Jjcl64dYYqprEhjhELiVLa/fl6ybgU4s9nUoB4A=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
@@ -26,8 +26,8 @@ github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
-github.com/gofrs/uuid v4.3.1+incompatible h1:0/KbAdpx3UXAx1kEOWHJeOkpbgRFGHVgv+CFIY7dBJI=
-github.com/gofrs/uuid v4.3.1+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
+github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA=
+github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -47,8 +47,8 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
-github.com/google/pprof v0.0.0-20221203041831-ce31453925ec h1:fR20TYVVwhK4O7r7y+McjRYyaTH6/vjwJOajE+XhlzM=
-github.com/google/pprof v0.0.0-20221203041831-ce31453925ec/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo=
+github.com/google/pprof v0.0.0-20230207041349-798e818bf904 h1:4/hN5RUoecvl+RmJRE2YxKWtnnQls6rQjjW5oV7qg2U=
+github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg=
github.com/google/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN9oE=
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
@@ -98,12 +98,12 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
-github.com/onsi/ginkgo/v2 v2.5.2-0.20221209042256-2165648f7697 h1:cwbr28f25XDERJx9lmFikpPwLAcSNpFGbTGPb2eIm/c=
-github.com/onsi/ginkgo/v2 v2.5.2-0.20221209042256-2165648f7697/go.mod h1:63DOGlLAH8+REH8jUGdL3YpCpu7JODesutUjdENfUAc=
+github.com/onsi/ginkgo/v2 v2.8.3 h1:RpbK1G8nWPNaCVFBWsOGnEQQGgASi6b8fxcWBvDYjxQ=
+github.com/onsi/ginkgo/v2 v2.8.3/go.mod h1:6OaUA8BCi0aZfmzYT/q9AacwTzDpNbxILUT+TlBq6MY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
-github.com/onsi/gomega v1.24.1 h1:KORJXNNTzJXzu4ScJWssJfJMnJ+2QJqhoQSRwNlze9E=
-github.com/onsi/gomega v1.24.1/go.mod h1:3AOiACssS3/MajrniINInwbfOOtfZvplPzuRSmvt1jM=
+github.com/onsi/gomega v1.27.1 h1:rfztXRbg6nv/5f+Raen9RcGoSecHIFgBBLQK3Wdj754=
+github.com/onsi/gomega v1.27.1/go.mod h1:aHX5xOykVYzWOV4WqQy0sy8BQptgukenXpCXfadcIAw=
github.com/packer-community/winrmcp v0.0.0-20221126162354-6e900dd2c68f h1:sWm3fnjG6kxvDuGiQf46Io5xCTj3QJfNJIeICJ4g1kw=
github.com/packer-community/winrmcp v0.0.0-20221126162354-6e900dd2c68f/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@@ -121,8 +121,8 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
-github.com/vmware/govmomi v0.29.0 h1:SHJQ7DUc4fltFZv16znJNGHR1/XhiDK5iKxm2OqwkuU=
-github.com/vmware/govmomi v0.29.0/go.mod h1:F7adsVewLNHsW/IIm7ziFURaXDaHEwcc+ym4r3INMdY=
+github.com/vmware/govmomi v0.30.2 h1:zPMmLTtAfBgOVsTgwKOzVVahQIOC4A2oyFQFSsn/0ag=
+github.com/vmware/govmomi v0.30.2/go.mod h1:F7adsVewLNHsW/IIm7ziFURaXDaHEwcc+ym4r3INMdY=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
@@ -131,12 +131,12 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
-golang.org/x/crypto v0.3.0 h1:a06MkbcxBrEFc0w0QIZWXrH/9cCX6KJyWbBOIwAn+7A=
-golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
+golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc=
+golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
-golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=
-golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
+golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
+golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
@@ -147,8 +147,8 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220725212005-46097bf591d3/go.mod h1:AaygXjzTFtRAg2ttMY5RMuhpJ3cNnI0XpyFJD1iQRSM=
-golang.org/x/net v0.3.0 h1:VWL6FNY2bEEmsGVKabSlHu5Irp34xmMRoqb/9lF9lxk=
-golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
+golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
+golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -170,22 +170,22 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
-golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
+golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/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.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM=
-golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
+golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
+golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
-golang.org/x/tools v0.4.0 h1:7mTAgkunk3fr4GAloyyCasadO6h9zSsQZbwvcaIciV4=
-golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ=
+golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
+golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
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/vendor/github.com/a8m/tree/.gitignore b/vendor/github.com/a8m/tree/.gitignore
index 793bf2eb..6714d1d5 100644
--- a/vendor/github.com/a8m/tree/.gitignore
+++ b/vendor/github.com/a8m/tree/.gitignore
@@ -1,2 +1,3 @@
draft
coverage
+*~
diff --git a/vendor/github.com/a8m/tree/.travis.yml b/vendor/github.com/a8m/tree/.travis.yml
index dbac1c6a..d7475be6 100644
--- a/vendor/github.com/a8m/tree/.travis.yml
+++ b/vendor/github.com/a8m/tree/.travis.yml
@@ -5,9 +5,9 @@ arch:
language: go
sudo: false
go:
- - 1.13.x
- - 1.14.x
- - 1.15.x
+ - 1.18.x
+ - 1.19.x
+ - 1.20.x
- tip
matrix:
allow_failures:
diff --git a/vendor/github.com/a8m/tree/csort_bsd.go b/vendor/github.com/a8m/tree/csort_bsd.go
index f5895a62..21af4b16 100644
--- a/vendor/github.com/a8m/tree/csort_bsd.go
+++ b/vendor/github.com/a8m/tree/csort_bsd.go
@@ -8,6 +8,9 @@ import (
)
func CTimeSort(f1, f2 os.FileInfo) bool {
+ if f1 == nil || f2 == nil {
+ return f2 == nil
+ }
s1, ok1 := f1.Sys().(*syscall.Stat_t)
s2, ok2 := f2.Sys().(*syscall.Stat_t)
// If this type of node isn't an os node then revert to ModSort
diff --git a/vendor/github.com/a8m/tree/csort_unix.go b/vendor/github.com/a8m/tree/csort_unix.go
index 6acd0922..e5777b89 100644
--- a/vendor/github.com/a8m/tree/csort_unix.go
+++ b/vendor/github.com/a8m/tree/csort_unix.go
@@ -1,4 +1,5 @@
-//+build linux openbsd dragonfly android solaris
+//go:build linux || openbsd || dragonfly || android || solaris
+// +build linux openbsd dragonfly android solaris
package tree
@@ -8,6 +9,9 @@ import (
)
func CTimeSort(f1, f2 os.FileInfo) bool {
+ if f1 == nil || f2 == nil {
+ return f2 == nil
+ }
s1, ok1 := f1.Sys().(*syscall.Stat_t)
s2, ok2 := f2.Sys().(*syscall.Stat_t)
// If this type of node isn't an os node then revert to ModSort
diff --git a/vendor/github.com/a8m/tree/node.go b/vendor/github.com/a8m/tree/node.go
index 0f1a7a16..fc365737 100644
--- a/vendor/github.com/a8m/tree/node.go
+++ b/vendor/github.com/a8m/tree/node.go
@@ -142,26 +142,28 @@ func (node *Node) Visit(opts *Options) (dirs, files int) {
vpaths: node.vpaths,
}
d, f := nnode.Visit(opts)
- if nnode.IsDir() {
- // "prune" option, hide empty directories
- if opts.Prune && f == 0 {
- continue
- }
- if opts.MatchDirs && opts.IPattern != "" && nnode.match(opts.IPattern, opts) {
- continue
- }
- } else if nnode.err == nil {
- // "dirs only" option
- if opts.DirsOnly {
- continue
- }
- // Pattern matching
- if !dirMatch && opts.Pattern != "" && !nnode.match(opts.Pattern, opts) {
- continue
- }
- // IPattern matching
- if opts.IPattern != "" && nnode.match(opts.IPattern, opts) {
- continue
+ if nnode.err == nil {
+ if nnode.IsDir() {
+ // "prune" option, hide empty directories
+ if opts.Prune && f == 0 {
+ continue
+ }
+ if opts.MatchDirs && opts.IPattern != "" && nnode.match(opts.IPattern, opts) {
+ continue
+ }
+ } else {
+ // "dirs only" option
+ if opts.DirsOnly {
+ continue
+ }
+ // Pattern matching
+ if !dirMatch && opts.Pattern != "" && !nnode.match(opts.Pattern, opts) {
+ continue
+ }
+ // IPattern matching
+ if opts.IPattern != "" && nnode.match(opts.IPattern, opts) {
+ continue
+ }
}
}
node.nodes = append(node.nodes, nnode)
@@ -252,7 +254,11 @@ func (node *Node) print(indent string, opts *Options) {
if msgs := strings.Split(err, ": "); len(msgs) > 1 {
err = msgs[1]
}
- fmt.Printf("%s [%s]\n", node.path, err)
+ name := node.path
+ if !opts.FullPath {
+ name = filepath.Base(name)
+ }
+ fmt.Fprintf(opts.OutFile, "%s [%s]\n", name, err)
return
}
if !node.IsDir() {
diff --git a/vendor/github.com/a8m/tree/sort.go b/vendor/github.com/a8m/tree/sort.go
index 55299935..0ee8a075 100644
--- a/vendor/github.com/a8m/tree/sort.go
+++ b/vendor/github.com/a8m/tree/sort.go
@@ -17,22 +17,38 @@ func (b ByFunc) Less(i, j int) bool {
type SortFunc func(f1, f2 os.FileInfo) bool
func ModSort(f1, f2 os.FileInfo) bool {
+ // This ensures any nil os.FileInfos sort at the end
+ if f1 == nil || f2 == nil {
+ return f2 == nil
+ }
return f1.ModTime().Before(f2.ModTime())
}
func DirSort(f1, f2 os.FileInfo) bool {
+ if f1 == nil || f2 == nil {
+ return f2 == nil
+ }
return f1.IsDir() && !f2.IsDir()
}
func SizeSort(f1, f2 os.FileInfo) bool {
+ if f1 == nil || f2 == nil {
+ return f2 == nil
+ }
return f1.Size() < f2.Size()
}
func NameSort(f1, f2 os.FileInfo) bool {
+ if f1 == nil || f2 == nil {
+ return f2 == nil
+ }
return f1.Name() < f2.Name()
}
func VerSort(f1, f2 os.FileInfo) bool {
+ if f1 == nil || f2 == nil {
+ return f2 == nil
+ }
return NaturalLess(f1.Name(), f2.Name())
}
diff --git a/vendor/github.com/gofrs/uuid/README.md b/vendor/github.com/gofrs/uuid/README.md
index f5db14f0..4f73bec8 100644
--- a/vendor/github.com/gofrs/uuid/README.md
+++ b/vendor/github.com/gofrs/uuid/README.md
@@ -17,7 +17,7 @@ This package supports the following UUID versions:
* Version 5, based on SHA-1 hashing of a named value (RFC-4122)
This package also supports experimental Universally Unique Identifier implementations based on a
-[draft RFC](https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03) that updates RFC-4122
+[draft RFC](https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-04.html) that updates RFC-4122
* Version 6, a k-sortable id based on timestamp, and field-compatible with v1 (draft-peabody-dispatch-new-uuid-format, RFC-4122)
* Version 7, a k-sortable id based on timestamp (draft-peabody-dispatch-new-uuid-format, RFC-4122)
@@ -114,4 +114,4 @@ func main() {
* [RFC-4122](https://tools.ietf.org/html/rfc4122)
* [DCE 1.1: Authentication and Security Services](http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01)
-* [New UUID Formats RFC Draft (Peabody) Rev 03](https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03)
+* [New UUID Formats RFC Draft (Peabody) Rev 04](https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-04.html#)
diff --git a/vendor/github.com/gofrs/uuid/codec.go b/vendor/github.com/gofrs/uuid/codec.go
index e3014c68..66502641 100644
--- a/vendor/github.com/gofrs/uuid/codec.go
+++ b/vendor/github.com/gofrs/uuid/codec.go
@@ -22,8 +22,7 @@
package uuid
import (
- "bytes"
- "encoding/hex"
+ "errors"
"fmt"
)
@@ -45,11 +44,77 @@ func FromBytesOrNil(input []byte) UUID {
return uuid
}
+var errInvalidFormat = errors.New("uuid: invalid UUID format")
+
+func fromHexChar(c byte) byte {
+ switch {
+ case '0' <= c && c <= '9':
+ return c - '0'
+ case 'a' <= c && c <= 'f':
+ return c - 'a' + 10
+ case 'A' <= c && c <= 'F':
+ return c - 'A' + 10
+ }
+ return 255
+}
+
+// Parse parses the UUID stored in the string text. Parsing and supported
+// formats are the same as UnmarshalText.
+func (u *UUID) Parse(s string) error {
+ switch len(s) {
+ case 32: // hash
+ case 36: // canonical
+ case 34, 38:
+ if s[0] != '{' || s[len(s)-1] != '}' {
+ return fmt.Errorf("uuid: incorrect UUID format in string %q", s)
+ }
+ s = s[1 : len(s)-1]
+ case 41, 45:
+ if s[:9] != "urn:uuid:" {
+ return fmt.Errorf("uuid: incorrect UUID format in string %q", s[:9])
+ }
+ s = s[9:]
+ default:
+ return fmt.Errorf("uuid: incorrect UUID length %d in string %q", len(s), s)
+ }
+ // canonical
+ if len(s) == 36 {
+ if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' {
+ return fmt.Errorf("uuid: incorrect UUID format in string %q", s)
+ }
+ for i, x := range [16]byte{
+ 0, 2, 4, 6,
+ 9, 11,
+ 14, 16,
+ 19, 21,
+ 24, 26, 28, 30, 32, 34,
+ } {
+ v1 := fromHexChar(s[x])
+ v2 := fromHexChar(s[x+1])
+ if v1|v2 == 255 {
+ return errInvalidFormat
+ }
+ u[i] = (v1 << 4) | v2
+ }
+ return nil
+ }
+ // hash like
+ for i := 0; i < 32; i += 2 {
+ v1 := fromHexChar(s[i])
+ v2 := fromHexChar(s[i+1])
+ if v1|v2 == 255 {
+ return errInvalidFormat
+ }
+ u[i/2] = (v1 << 4) | v2
+ }
+ return nil
+}
+
// FromString returns a UUID parsed from the input string.
// Input is expected in a form accepted by UnmarshalText.
-func FromString(input string) (UUID, error) {
- u := UUID{}
- err := u.UnmarshalText([]byte(input))
+func FromString(text string) (UUID, error) {
+ var u UUID
+ err := u.Parse(text)
return u, err
}
@@ -66,133 +131,90 @@ func FromStringOrNil(input string) UUID {
// MarshalText implements the encoding.TextMarshaler interface.
// The encoding is the same as returned by the String() method.
func (u UUID) MarshalText() ([]byte, error) {
- return []byte(u.String()), nil
+ var buf [36]byte
+ encodeCanonical(buf[:], u)
+ return buf[:], nil
}
// UnmarshalText implements the encoding.TextUnmarshaler interface.
// Following formats are supported:
//
-// "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
-// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}",
-// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8"
-// "6ba7b8109dad11d180b400c04fd430c8"
-// "{6ba7b8109dad11d180b400c04fd430c8}",
-// "urn:uuid:6ba7b8109dad11d180b400c04fd430c8"
+// "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
+// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}",
+// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8"
+// "6ba7b8109dad11d180b400c04fd430c8"
+// "{6ba7b8109dad11d180b400c04fd430c8}",
+// "urn:uuid:6ba7b8109dad11d180b400c04fd430c8"
//
// ABNF for supported UUID text representation follows:
//
-// URN := 'urn'
-// UUID-NID := 'uuid'
-//
-// hexdig := '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' |
-// 'a' | 'b' | 'c' | 'd' | 'e' | 'f' |
-// 'A' | 'B' | 'C' | 'D' | 'E' | 'F'
+// URN := 'urn'
+// UUID-NID := 'uuid'
//
-// hexoct := hexdig hexdig
-// 2hexoct := hexoct hexoct
-// 4hexoct := 2hexoct 2hexoct
-// 6hexoct := 4hexoct 2hexoct
-// 12hexoct := 6hexoct 6hexoct
+// hexdig := '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' |
+// 'a' | 'b' | 'c' | 'd' | 'e' | 'f' |
+// 'A' | 'B' | 'C' | 'D' | 'E' | 'F'
//
-// hashlike := 12hexoct
-// canonical := 4hexoct '-' 2hexoct '-' 2hexoct '-' 6hexoct
+// hexoct := hexdig hexdig
+// 2hexoct := hexoct hexoct
+// 4hexoct := 2hexoct 2hexoct
+// 6hexoct := 4hexoct 2hexoct
+// 12hexoct := 6hexoct 6hexoct
//
-// plain := canonical | hashlike
-// uuid := canonical | hashlike | braced | urn
+// hashlike := 12hexoct
+// canonical := 4hexoct '-' 2hexoct '-' 2hexoct '-' 6hexoct
//
-// braced := '{' plain '}' | '{' hashlike '}'
-// urn := URN ':' UUID-NID ':' plain
+// plain := canonical | hashlike
+// uuid := canonical | hashlike | braced | urn
//
-func (u *UUID) UnmarshalText(text []byte) error {
- switch len(text) {
- case 32:
- return u.decodeHashLike(text)
+// braced := '{' plain '}' | '{' hashlike '}'
+// urn := URN ':' UUID-NID ':' plain
+func (u *UUID) UnmarshalText(b []byte) error {
+ switch len(b) {
+ case 32: // hash
+ case 36: // canonical
case 34, 38:
- return u.decodeBraced(text)
- case 36:
- return u.decodeCanonical(text)
+ if b[0] != '{' || b[len(b)-1] != '}' {
+ return fmt.Errorf("uuid: incorrect UUID format in string %q", b)
+ }
+ b = b[1 : len(b)-1]
case 41, 45:
- return u.decodeURN(text)
+ if string(b[:9]) != "urn:uuid:" {
+ return fmt.Errorf("uuid: incorrect UUID format in string %q", b[:9])
+ }
+ b = b[9:]
default:
- return fmt.Errorf("uuid: incorrect UUID length %d in string %q", len(text), text)
- }
-}
-
-// decodeCanonical decodes UUID strings that are formatted as defined in RFC-4122 (section 3):
-// "6ba7b810-9dad-11d1-80b4-00c04fd430c8".
-func (u *UUID) decodeCanonical(t []byte) error {
- if t[8] != '-' || t[13] != '-' || t[18] != '-' || t[23] != '-' {
- return fmt.Errorf("uuid: incorrect UUID format in string %q", t)
+ return fmt.Errorf("uuid: incorrect UUID length %d in string %q", len(b), b)
}
-
- src := t
- dst := u[:]
-
- for i, byteGroup := range byteGroups {
- if i > 0 {
- src = src[1:] // skip dash
+ if len(b) == 36 {
+ if b[8] != '-' || b[13] != '-' || b[18] != '-' || b[23] != '-' {
+ return fmt.Errorf("uuid: incorrect UUID format in string %q", b)
}
- _, err := hex.Decode(dst[:byteGroup/2], src[:byteGroup])
- if err != nil {
- return err
+ for i, x := range [16]byte{
+ 0, 2, 4, 6,
+ 9, 11,
+ 14, 16,
+ 19, 21,
+ 24, 26, 28, 30, 32, 34,
+ } {
+ v1 := fromHexChar(b[x])
+ v2 := fromHexChar(b[x+1])
+ if v1|v2 == 255 {
+ return errInvalidFormat
+ }
+ u[i] = (v1 << 4) | v2
}
- src = src[byteGroup:]
- dst = dst[byteGroup/2:]
- }
-
- return nil
-}
-
-// decodeHashLike decodes UUID strings that are using the following format:
-// "6ba7b8109dad11d180b400c04fd430c8".
-func (u *UUID) decodeHashLike(t []byte) error {
- src := t[:]
- dst := u[:]
-
- _, err := hex.Decode(dst, src)
- return err
-}
-
-// decodeBraced decodes UUID strings that are using the following formats:
-// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}"
-// "{6ba7b8109dad11d180b400c04fd430c8}".
-func (u *UUID) decodeBraced(t []byte) error {
- l := len(t)
-
- if t[0] != '{' || t[l-1] != '}' {
- return fmt.Errorf("uuid: incorrect UUID format in string %q", t)
+ return nil
}
-
- return u.decodePlain(t[1 : l-1])
-}
-
-// decodeURN decodes UUID strings that are using the following formats:
-// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8"
-// "urn:uuid:6ba7b8109dad11d180b400c04fd430c8".
-func (u *UUID) decodeURN(t []byte) error {
- total := len(t)
-
- urnUUIDPrefix := t[:9]
-
- if !bytes.Equal(urnUUIDPrefix, urnPrefix) {
- return fmt.Errorf("uuid: incorrect UUID format in string %q", t)
- }
-
- return u.decodePlain(t[9:total])
-}
-
-// decodePlain decodes UUID strings that are using the following formats:
-// "6ba7b810-9dad-11d1-80b4-00c04fd430c8" or in hash-like format
-// "6ba7b8109dad11d180b400c04fd430c8".
-func (u *UUID) decodePlain(t []byte) error {
- switch len(t) {
- case 32:
- return u.decodeHashLike(t)
- case 36:
- return u.decodeCanonical(t)
- default:
- return fmt.Errorf("uuid: incorrect UUID length %d in string %q", len(t), t)
+ for i := 0; i < 32; i += 2 {
+ v1 := fromHexChar(b[i])
+ v2 := fromHexChar(b[i+1])
+ if v1|v2 == 255 {
+ return errInvalidFormat
+ }
+ u[i/2] = (v1 << 4) | v2
}
+ return nil
}
// MarshalBinary implements the encoding.BinaryMarshaler interface.
diff --git a/vendor/github.com/gofrs/uuid/fuzz.go b/vendor/github.com/gofrs/uuid/fuzz.go
index afaefbc8..ccf8d4ca 100644
--- a/vendor/github.com/gofrs/uuid/fuzz.go
+++ b/vendor/github.com/gofrs/uuid/fuzz.go
@@ -19,6 +19,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//go:build gofuzz
// +build gofuzz
package uuid
@@ -27,15 +28,15 @@ package uuid
//
// To run:
//
-// $ go get github.com/dvyukov/go-fuzz/...
-// $ cd $GOPATH/src/github.com/gofrs/uuid
-// $ go-fuzz-build github.com/gofrs/uuid
-// $ go-fuzz -bin=uuid-fuzz.zip -workdir=./testdata
+// $ go get github.com/dvyukov/go-fuzz/...
+// $ cd $GOPATH/src/github.com/gofrs/uuid
+// $ go-fuzz-build github.com/gofrs/uuid
+// $ go-fuzz -bin=uuid-fuzz.zip -workdir=./testdata
//
// If you make significant changes to FromString / UnmarshalText and add
// new cases to fromStringTests (in codec_test.go), please run
//
-// $ go test -seed_fuzz_corpus
+// $ go test -seed_fuzz_corpus
//
// to seed the corpus with the new interesting inputs, then run the fuzzer.
func Fuzz(data []byte) int {
diff --git a/vendor/github.com/gofrs/uuid/generator.go b/vendor/github.com/gofrs/uuid/generator.go
index 4550bc6b..44be9e15 100644
--- a/vendor/github.com/gofrs/uuid/generator.go
+++ b/vendor/github.com/gofrs/uuid/generator.go
@@ -38,7 +38,8 @@ import (
// UUID epoch (October 15, 1582) and Unix epoch (January 1, 1970).
const epochStart = 122192928000000000
-type epochFunc func() time.Time
+// EpochFunc is the function type used to provide the current time.
+type EpochFunc func() time.Time
// HWAddrFunc is the function type used to provide hardware (MAC) addresses.
type HWAddrFunc func() (net.HardwareAddr, error)
@@ -80,9 +81,9 @@ func NewV6() (UUID, error) {
}
// NewV7 returns a k-sortable UUID based on the current millisecond precision
-// UNIX epoch and 74 bits of pseudorandom data.
+// UNIX epoch and 74 bits of pseudorandom data. It supports single-node batch generation (multiple UUIDs in the same timestamp) with a Monotonic Random counter.
//
-// This is implemented based on revision 03 of the Peabody UUID draft, and may
+// This is implemented based on revision 04 of the Peabody UUID draft, and may
// be subject to change pending further revisions. Until the final specification
// revision is finished, changes required to implement updates to the spec will
// not be considered a breaking change. They will happen as a minor version
@@ -119,13 +120,16 @@ type Gen struct {
rand io.Reader
- epochFunc epochFunc
+ epochFunc EpochFunc
hwAddrFunc HWAddrFunc
lastTime uint64
clockSequence uint16
hardwareAddr [6]byte
}
+// GenOption is a function type that can be used to configure a Gen generator.
+type GenOption func(*Gen)
+
// interface check -- build will fail if *Gen doesn't satisfy Generator
var _ Generator = (*Gen)(nil)
@@ -147,18 +151,82 @@ func NewGen() *Gen {
// MAC address being used, you'll need to create a new generator using this
// function.
func NewGenWithHWAF(hwaf HWAddrFunc) *Gen {
- return &Gen{
+ return NewGenWithOptions(WithHWAddrFunc(hwaf))
+}
+
+// NewGenWithOptions returns a new instance of Gen with the options provided.
+// Most people should use NewGen() or NewGenWithHWAF() instead.
+//
+// To customize the generator, you can pass in one or more GenOption functions.
+// For example:
+//
+// gen := NewGenWithOptions(
+// WithHWAddrFunc(myHWAddrFunc),
+// WithEpochFunc(myEpochFunc),
+// WithRandomReader(myRandomReader),
+// )
+//
+// NewGenWithOptions(WithHWAddrFunc(myHWAddrFunc)) is equivalent to calling
+// NewGenWithHWAF(myHWAddrFunc)
+// NewGenWithOptions() is equivalent to calling NewGen()
+func NewGenWithOptions(opts ...GenOption) *Gen {
+ gen := &Gen{
epochFunc: time.Now,
- hwAddrFunc: hwaf,
+ hwAddrFunc: defaultHWAddrFunc,
rand: rand.Reader,
}
+
+ for _, opt := range opts {
+ opt(gen)
+ }
+
+ return gen
+}
+
+// WithHWAddrFunc is a GenOption that allows you to provide your own HWAddrFunc
+// function.
+// When this option is nil, the defaultHWAddrFunc is used.
+func WithHWAddrFunc(hwaf HWAddrFunc) GenOption {
+ return func(gen *Gen) {
+ if hwaf == nil {
+ hwaf = defaultHWAddrFunc
+ }
+
+ gen.hwAddrFunc = hwaf
+ }
+}
+
+// WithEpochFunc is a GenOption that allows you to provide your own EpochFunc
+// function.
+// When this option is nil, time.Now is used.
+func WithEpochFunc(epochf EpochFunc) GenOption {
+ return func(gen *Gen) {
+ if epochf == nil {
+ epochf = time.Now
+ }
+
+ gen.epochFunc = epochf
+ }
+}
+
+// WithRandomReader is a GenOption that allows you to provide your own random
+// reader.
+// When this option is nil, the default rand.Reader is used.
+func WithRandomReader(reader io.Reader) GenOption {
+ return func(gen *Gen) {
+ if reader == nil {
+ reader = rand.Reader
+ }
+
+ gen.rand = reader
+ }
}
// NewV1 returns a UUID based on the current timestamp and MAC address.
func (g *Gen) NewV1() (UUID, error) {
u := UUID{}
- timeNow, clockSeq, err := g.getClockSequence()
+ timeNow, clockSeq, err := g.getClockSequence(false)
if err != nil {
return Nil, err
}
@@ -225,7 +293,7 @@ func (g *Gen) NewV6() (UUID, error) {
return Nil, err
}
- timeNow, clockSeq, err := g.getClockSequence()
+ timeNow, clockSeq, err := g.getClockSequence(false)
if err != nil {
return Nil, err
}
@@ -241,8 +309,12 @@ func (g *Gen) NewV6() (UUID, error) {
return u, nil
}
-// getClockSequence returns the epoch and clock sequence for V1 and V6 UUIDs.
-func (g *Gen) getClockSequence() (uint64, uint16, error) {
+// getClockSequence returns the epoch and clock sequence for V1,V6 and V7 UUIDs.
+//
+// When useUnixTSMs is false, it uses the Coordinated Universal Time (UTC) as a count of 100-
+//
+// nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of Gregorian reform to the Christian calendar).
+func (g *Gen) getClockSequence(useUnixTSMs bool) (uint64, uint16, error) {
var err error
g.clockSequenceOnce.Do(func() {
buf := make([]byte, 2)
@@ -258,7 +330,12 @@ func (g *Gen) getClockSequence() (uint64, uint16, error) {
g.storageMutex.Lock()
defer g.storageMutex.Unlock()
- timeNow := g.getEpoch()
+ var timeNow uint64
+ if useUnixTSMs {
+ timeNow = uint64(g.epochFunc().UnixMilli())
+ } else {
+ timeNow = g.getEpoch()
+ }
// Clock didn't change since last UUID generation.
// Should increase clock sequence.
if timeNow <= g.lastTime {
@@ -272,28 +349,51 @@ func (g *Gen) getClockSequence() (uint64, uint16, error) {
// NewV7 returns a k-sortable UUID based on the current millisecond precision
// UNIX epoch and 74 bits of pseudorandom data.
//
-// This is implemented based on revision 03 of the Peabody UUID draft, and may
+// This is implemented based on revision 04 of the Peabody UUID draft, and may
// be subject to change pending further revisions. Until the final specification
// revision is finished, changes required to implement updates to the spec will
// not be considered a breaking change. They will happen as a minor version
// releases until the spec is final.
func (g *Gen) NewV7() (UUID, error) {
var u UUID
-
- if _, err := io.ReadFull(g.rand, u[6:]); err != nil {
+ /* https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-04.html#name-uuid-version-7
+ 0 1 2 3
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | unix_ts_ms |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | unix_ts_ms | ver | rand_a |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ |var| rand_b |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | rand_b |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
+
+ ms, clockSeq, err := g.getClockSequence(true)
+ if err != nil {
return Nil, err
}
-
- tn := g.epochFunc()
- ms := uint64(tn.Unix())*1e3 + uint64(tn.Nanosecond())/1e6
- u[0] = byte(ms >> 40)
+ //UUIDv7 features a 48 bit timestamp. First 32bit (4bytes) represents seconds since 1970, followed by 2 bytes for the ms granularity.
+ u[0] = byte(ms >> 40) //1-6 bytes: big-endian unsigned number of Unix epoch timestamp
u[1] = byte(ms >> 32)
u[2] = byte(ms >> 24)
u[3] = byte(ms >> 16)
u[4] = byte(ms >> 8)
u[5] = byte(ms)
+ //support batching by using a monotonic pseudo-random sequence
+ //The 6th byte contains the version and partially rand_a data.
+ //We will lose the most significant bites from the clockSeq (with SetVersion), but it is ok, we need the least significant that contains the counter to ensure the monotonic property
+ binary.BigEndian.PutUint16(u[6:8], clockSeq) // set rand_a with clock seq which is random and monotonic
+
+ //override first 4bits of u[6].
u.SetVersion(V7)
+
+ //set rand_b 64bits of pseudo-random bits (first 2 will be overridden)
+ if _, err = io.ReadFull(g.rand, u[8:16]); err != nil {
+ return Nil, err
+ }
+ //override first 2 bits of byte[8] for the variant
u.SetVariant(VariantRFC4122)
return u, nil
diff --git a/vendor/github.com/gofrs/uuid/sql.go b/vendor/github.com/gofrs/uuid/sql.go
index 6f254a4f..01d5d884 100644
--- a/vendor/github.com/gofrs/uuid/sql.go
+++ b/vendor/github.com/gofrs/uuid/sql.go
@@ -22,12 +22,14 @@
package uuid
import (
- "bytes"
+ "database/sql"
"database/sql/driver"
- "encoding/json"
"fmt"
)
+var _ driver.Valuer = UUID{}
+var _ sql.Scanner = (*UUID)(nil)
+
// Value implements the driver.Valuer interface.
func (u UUID) Value() (driver.Value, error) {
return u.String(), nil
@@ -49,7 +51,9 @@ func (u *UUID) Scan(src interface{}) error {
return u.UnmarshalText(src)
case string:
- return u.UnmarshalText([]byte(src))
+ uu, err := FromString(src)
+ *u = uu
+ return err
}
return fmt.Errorf("uuid: cannot convert %T to UUID", src)
@@ -83,27 +87,30 @@ func (u *NullUUID) Scan(src interface{}) error {
return u.UUID.Scan(src)
}
+var nullJSON = []byte("null")
+
// MarshalJSON marshals the NullUUID as null or the nested UUID
func (u NullUUID) MarshalJSON() ([]byte, error) {
if !u.Valid {
- return json.Marshal(nil)
+ return nullJSON, nil
}
-
- return json.Marshal(u.UUID)
+ var buf [38]byte
+ buf[0] = '"'
+ encodeCanonical(buf[1:37], u.UUID)
+ buf[37] = '"'
+ return buf[:], nil
}
// UnmarshalJSON unmarshals a NullUUID
func (u *NullUUID) UnmarshalJSON(b []byte) error {
- if bytes.Equal(b, []byte("null")) {
+ if string(b) == "null" {
u.UUID, u.Valid = Nil, false
return nil
}
-
- if err := json.Unmarshal(b, &u.UUID); err != nil {
- return err
+ if n := len(b); n >= 2 && b[0] == '"' {
+ b = b[1 : n-1]
}
-
- u.Valid = true
-
- return nil
+ err := u.UUID.UnmarshalText(b)
+ u.Valid = (err == nil)
+ return err
}
diff --git a/vendor/github.com/gofrs/uuid/uuid.go b/vendor/github.com/gofrs/uuid/uuid.go
index e747e541..5320fb53 100644
--- a/vendor/github.com/gofrs/uuid/uuid.go
+++ b/vendor/github.com/gofrs/uuid/uuid.go
@@ -44,8 +44,6 @@ import (
"encoding/binary"
"encoding/hex"
"fmt"
- "io"
- "strings"
"time"
)
@@ -133,12 +131,6 @@ func TimestampFromV6(u UUID) (Timestamp, error) {
return Timestamp(uint64(low) + (uint64(mid) << 12) + (uint64(hi) << 28)), nil
}
-// String parse helpers.
-var (
- urnPrefix = []byte("urn:uuid:")
- byteGroups = []int{8, 4, 4, 4, 12}
-)
-
// Nil is the nil UUID, as specified in RFC-4122, that has all 128 bits set to
// zero.
var Nil = UUID{}
@@ -182,22 +174,33 @@ func (u UUID) Bytes() []byte {
return u[:]
}
+// encodeCanonical encodes the canonical RFC-4122 form of UUID u into the
+// first 36 bytes dst.
+func encodeCanonical(dst []byte, u UUID) {
+ const hextable = "0123456789abcdef"
+ dst[8] = '-'
+ dst[13] = '-'
+ dst[18] = '-'
+ dst[23] = '-'
+ for i, x := range [16]byte{
+ 0, 2, 4, 6,
+ 9, 11,
+ 14, 16,
+ 19, 21,
+ 24, 26, 28, 30, 32, 34,
+ } {
+ c := u[i]
+ dst[x] = hextable[c>>4]
+ dst[x+1] = hextable[c&0x0f]
+ }
+}
+
// String returns a canonical RFC-4122 string representation of the UUID:
// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
func (u UUID) String() string {
- buf := make([]byte, 36)
-
- hex.Encode(buf[0:8], u[0:4])
- buf[8] = '-'
- hex.Encode(buf[9:13], u[4:6])
- buf[13] = '-'
- hex.Encode(buf[14:18], u[6:8])
- buf[18] = '-'
- hex.Encode(buf[19:23], u[8:10])
- buf[23] = '-'
- hex.Encode(buf[24:], u[10:])
-
- return string(buf)
+ var buf [36]byte
+ encodeCanonical(buf[:], u)
+ return string(buf[:])
}
// Format implements fmt.Formatter for UUID values.
@@ -210,52 +213,41 @@ func (u UUID) String() string {
// All other verbs not handled directly by the fmt package (like '%p') are unsupported and will return
// "%!verb(uuid.UUID=value)" as recommended by the fmt package.
func (u UUID) Format(f fmt.State, c rune) {
+ if c == 'v' && f.Flag('#') {
+ fmt.Fprintf(f, "%#v", [Size]byte(u))
+ return
+ }
switch c {
case 'x', 'X':
- s := hex.EncodeToString(u.Bytes())
+ b := make([]byte, 32)
+ hex.Encode(b, u[:])
if c == 'X' {
- s = strings.Map(toCapitalHexDigits, s)
- }
- _, _ = io.WriteString(f, s)
- case 'v':
- var s string
- if f.Flag('#') {
- s = fmt.Sprintf("%#v", [Size]byte(u))
- } else {
- s = u.String()
+ toUpperHex(b)
}
- _, _ = io.WriteString(f, s)
- case 's', 'S':
- s := u.String()
+ _, _ = f.Write(b)
+ case 'v', 's', 'S':
+ b, _ := u.MarshalText()
if c == 'S' {
- s = strings.Map(toCapitalHexDigits, s)
+ toUpperHex(b)
}
- _, _ = io.WriteString(f, s)
+ _, _ = f.Write(b)
case 'q':
- _, _ = io.WriteString(f, `"`+u.String()+`"`)
+ b := make([]byte, 38)
+ b[0] = '"'
+ encodeCanonical(b[1:], u)
+ b[37] = '"'
+ _, _ = f.Write(b)
default:
// invalid/unsupported format verb
fmt.Fprintf(f, "%%!%c(uuid.UUID=%s)", c, u.String())
}
}
-func toCapitalHexDigits(ch rune) rune {
- // convert a-f hex digits to A-F
- switch ch {
- case 'a':
- return 'A'
- case 'b':
- return 'B'
- case 'c':
- return 'C'
- case 'd':
- return 'D'
- case 'e':
- return 'E'
- case 'f':
- return 'F'
- default:
- return ch
+func toUpperHex(b []byte) {
+ for i, c := range b {
+ if 'a' <= c && c <= 'f' {
+ b[i] = c - ('a' - 'A')
+ }
}
}
@@ -283,7 +275,8 @@ func (u *UUID) SetVariant(v byte) {
// Must is a helper that wraps a call to a function returning (UUID, error)
// and panics if the error is non-nil. It is intended for use in variable
// initializations such as
-// var packageUUID = uuid.Must(uuid.FromString("123e4567-e89b-12d3-a456-426655440000"))
+//
+// var packageUUID = uuid.Must(uuid.FromString("123e4567-e89b-12d3-a456-426655440000"))
func Must(u UUID, err error) UUID {
if err != nil {
panic(err)
diff --git a/vendor/github.com/google/pprof/profile/profile.go b/vendor/github.com/google/pprof/profile/profile.go
index 4ec00fe7..60ef7e92 100644
--- a/vendor/github.com/google/pprof/profile/profile.go
+++ b/vendor/github.com/google/pprof/profile/profile.go
@@ -72,9 +72,23 @@ type ValueType struct {
type Sample struct {
Location []*Location
Value []int64
- Label map[string][]string
+ // Label is a per-label-key map to values for string labels.
+ //
+ // In general, having multiple values for the given label key is strongly
+ // discouraged - see docs for the sample label field in profile.proto. The
+ // main reason this unlikely state is tracked here is to make the
+ // decoding->encoding roundtrip not lossy. But we expect that the value
+ // slices present in this map are always of length 1.
+ Label map[string][]string
+ // NumLabel is a per-label-key map to values for numeric labels. See a note
+ // above on handling multiple values for a label.
NumLabel map[string][]int64
- NumUnit map[string][]string
+ // NumUnit is a per-label-key map to the unit names of corresponding numeric
+ // label values. The unit info may be missing even if the label is in
+ // NumLabel, see the docs in profile.proto for details. When the value is
+ // slice is present and not nil, its length must be equal to the length of
+ // the corresponding value slice in NumLabel.
+ NumUnit map[string][]string
locationIDX []uint64
labelX []label
@@ -715,6 +729,35 @@ func (s *Sample) HasLabel(key, value string) bool {
return false
}
+// SetNumLabel sets the specified key to the specified value for all samples in the
+// profile. "unit" is a slice that describes the units that each corresponding member
+// of "values" is measured in (e.g. bytes or seconds). If there is no relevant
+// unit for a given value, that member of "unit" should be the empty string.
+// "unit" must either have the same length as "value", or be nil.
+func (p *Profile) SetNumLabel(key string, value []int64, unit []string) {
+ for _, sample := range p.Sample {
+ if sample.NumLabel == nil {
+ sample.NumLabel = map[string][]int64{key: value}
+ } else {
+ sample.NumLabel[key] = value
+ }
+ if sample.NumUnit == nil {
+ sample.NumUnit = map[string][]string{key: unit}
+ } else {
+ sample.NumUnit[key] = unit
+ }
+ }
+}
+
+// RemoveNumLabel removes all numerical labels associated with the specified key for all
+// samples in the profile.
+func (p *Profile) RemoveNumLabel(key string) {
+ for _, sample := range p.Sample {
+ delete(sample.NumLabel, key)
+ delete(sample.NumUnit, key)
+ }
+}
+
// DiffBaseSample returns true if a sample belongs to the diff base and false
// otherwise.
func (s *Sample) DiffBaseSample() bool {
diff --git a/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md b/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md
index b723d4e5..a77e95e2 100644
--- a/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md
+++ b/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md
@@ -1,3 +1,133 @@
+## 2.8.3
+
+Released to fix security issue in golang.org/x/net dependency
+
+### Maintenance
+
+- Bump golang.org/x/net from 0.6.0 to 0.7.0 (#1141) [fc1a02e]
+- remove tools.go hack from documentation [0718693]
+
+## 2.8.2
+
+Ginkgo now includes a `tools.go` file in the root directory of the `ginkgo` package. This should allow modules that simply `go get github.com/onsi/ginkgo/v2` to also pull in the CLI dependencies. This obviates the need for consumers of Ginkgo to have their own `tools.go` file and makes it simpler to ensure that the version of the `ginkgo` CLI being used matches the version of the library. You can simply run `go run github.com/onsi/ginkgo/v2/ginkgo` to run the version of the cli associated with your package go.mod.
+
+### Maintenance
+
+- Bump github.com/onsi/gomega from 1.26.0 to 1.27.0 (#1139) [5767b0a]
+- Fix minor typos (#1138) [e1e9723]
+- Fix link in V2 Migration Guide (#1137) [a588f60]
+
+## 2.8.1
+
+### Fixes
+- lock around default report output to avoid triggering the race detector when calling By from goroutines [2d5075a]
+- don't run ReportEntries through sprintf [febbe38]
+
+### Maintenance
+- Bump golang.org/x/tools from 0.5.0 to 0.6.0 (#1135) [11a4860]
+- test: update matrix for Go 1.20 (#1130) [4890a62]
+- Bump golang.org/x/sys from 0.4.0 to 0.5.0 (#1133) [a774638]
+- Bump github.com/onsi/gomega from 1.25.0 to 1.26.0 (#1120) [3f233bd]
+- Bump github-pages from 227 to 228 in /docs (#1131) [f9b8649]
+- Bump activesupport from 6.0.6 to 6.0.6.1 in /docs (#1127) [6f8c042]
+- Update index.md with instructions on how to upgrade Ginkgo [833a75e]
+
+## 2.8.0
+
+### Features
+
+- Introduce GinkgoHelper() to track and exclude helper functions from potential CodeLocations [e19f556]
+
+Modeled after `testing.T.Helper()`. Now, rather than write code like:
+
+```go
+func helper(model Model) {
+ Expect(model).WithOffset(1).To(BeValid())
+ Expect(model.SerialNumber).WithOffset(1).To(MatchRegexp(/[a-f0-9]*/))
+}
+```
+
+you can stop tracking offsets (which makes nesting composing helpers nearly impossible) and simply write:
+
+```go
+func helper(model Model) {
+ GinkgoHelper()
+ Expect(model).To(BeValid())
+ Expect(model.SerialNumber).To(MatchRegexp(/[a-f0-9]*/))
+}
+```
+
+- Introduce GinkgoLabelFilter() and Label().MatchesLabelFilter() to make it possible to programmatically match filters (fixes #1119) [2f6597c]
+
+You can now write code like this:
+
+```go
+BeforeSuite(func() {
+ if Label("slow").MatchesLabelFilter(GinkgoLabelFilter()) {
+ // do slow setup
+ }
+
+ if Label("fast").MatchesLabelFilter(GinkgoLabelFilter()) {
+ // do fast setup
+ }
+})
+```
+
+to programmatically check whether a given set of labels will match the configured `--label-filter`.
+
+### Maintenance
+
+- Bump webrick from 1.7.0 to 1.8.1 in /docs (#1125) [ea4966e]
+- cdeql: add ruby language (#1124) [9dd275b]
+- dependabot: add bundler package-ecosystem for docs (#1123) [14e7bdd]
+
+## 2.7.1
+
+### Fixes
+- Bring back SuiteConfig.EmitSpecProgress to avoid compilation issue for consumers that set it manually [d2a1cb0]
+
+### Maintenance
+- Bump github.com/onsi/gomega from 1.24.2 to 1.25.0 (#1118) [cafece6]
+- Bump golang.org/x/tools from 0.4.0 to 0.5.0 (#1111) [eda66c2]
+- Bump golang.org/x/sys from 0.3.0 to 0.4.0 (#1112) [ac5ccaa]
+- Bump github.com/onsi/gomega from 1.24.1 to 1.24.2 (#1097) [eee6480]
+
+## 2.7.0
+
+### Features
+- Introduce ContinueOnFailure for Ordered containers [e0123ca] - Ordered containers that are also decorated with ContinueOnFailure will not stop running specs after the first spec fails.
+- Support for bootstrap commands to use custom data for templates (#1110) [7a2b242]
+- Support for labels and pending decorator in ginkgo outline output (#1113) [e6e3b98]
+- Color aliases for custom color support (#1101) [49fab7a]
+
+### Fixes
+- correctly ensure deterministic spec order, even if specs are generated by iterating over a map [89dda20]
+- Fix a bug where timedout specs were not correctly treated as failures when determining whether or not to run AfterAlls in an Ordered container.
+- Ensure go test coverprofile outputs to the expected location (#1105) [b0bd77b]
+
+## 2.6.1
+
+### Features
+- Override formatter colors from envvars - this is a new feature but an alternative approach involving config files might be taken in the future (#1095) [60240d1]
+
+### Fixes
+- GinkgoRecover now supports ignoring panics that match a specific, hidden, interface [301f3e2]
+
+### Maintenance
+- Bump github.com/onsi/gomega from 1.24.0 to 1.24.1 (#1077) [3643823]
+- Bump golang.org/x/tools from 0.2.0 to 0.4.0 (#1090) [f9f856e]
+- Bump nokogiri from 1.13.9 to 1.13.10 in /docs (#1091) [0d7087e]
+
+## 2.6.0
+
+### Features
+- `ReportBeforeSuite` provides access to the suite report before the suite begins.
+- Add junit config option for omitting leafnodetype (#1088) [956e6d2]
+- Add support to customize junit report config to omit spec labels (#1087) [de44005]
+
+### Fixes
+- Fix stack trace pruning so that it has a chance of working on windows [2165648]
+
## 2.5.1
### Fixes
@@ -53,7 +183,7 @@ to build tooling on top of as it has stronger guarantees to be stable from versi
### Fixes
- correcting some typos (#1064) [1403d3c]
-- fix flaky internal_integration interupt specs [2105ba3]
+- fix flaky internal_integration interrupt specs [2105ba3]
- Correct busted link in README [be6b5b9]
### Maintenance
diff --git a/vendor/github.com/onsi/ginkgo/v2/core_dsl.go b/vendor/github.com/onsi/ginkgo/v2/core_dsl.go
index 5a08574c..0b13b0d2 100644
--- a/vendor/github.com/onsi/ginkgo/v2/core_dsl.go
+++ b/vendor/github.com/onsi/ginkgo/v2/core_dsl.go
@@ -92,11 +92,11 @@ type GinkgoWriterInterface interface {
}
/*
-SpecContext is the context object passed into nodes that are subject to a timeout or need to be notified of an interrupt. It implements the standard context.Context interface but also contains additional helpers to provide an extensibility point for Ginkgo. (As an example, Gomega's Eventually can use the methods defined on SpecContext to provide deeper integratoin with Ginkgo).
+SpecContext is the context object passed into nodes that are subject to a timeout or need to be notified of an interrupt. It implements the standard context.Context interface but also contains additional helpers to provide an extensibility point for Ginkgo. (As an example, Gomega's Eventually can use the methods defined on SpecContext to provide deeper integration with Ginkgo).
You can do anything with SpecContext that you do with a typical context.Context including wrapping it with any of the context.With* methods.
-Ginkgo will cancel the SpecContext when a node is interrupted (e.g. by the user sending an interupt signal) or when a node has exceeded it's allowed run-time. Note, however, that even in cases where a node has a deadline, SpecContext will not return a deadline via .Deadline(). This is because Ginkgo does not use a WithDeadline() context to model node deadlines as Ginkgo needs control over the precise timing of the context cancellation to ensure it can provide an accurate progress report at the moment of cancellation.
+Ginkgo will cancel the SpecContext when a node is interrupted (e.g. by the user sending an interrupt signal) or when a node has exceeded its allowed run-time. Note, however, that even in cases where a node has a deadline, SpecContext will not return a deadline via .Deadline(). This is because Ginkgo does not use a WithDeadline() context to model node deadlines as Ginkgo needs control over the precise timing of the context cancellation to ensure it can provide an accurate progress report at the moment of cancellation.
*/
type SpecContext = internal.SpecContext
@@ -163,6 +163,29 @@ func GinkgoParallelProcess() int {
return suiteConfig.ParallelProcess
}
+/*
+GinkgoHelper marks the function it's called in as a test helper. When a failure occurs inside a helper function, Ginkgo will skip the helper when analyzing the stack trace to identify where the failure occurred.
+
+This is an alternative, simpler, mechanism to passing in a skip offset when calling Fail or using Gomega.
+*/
+func GinkgoHelper() {
+ types.MarkAsHelper(1)
+}
+
+/*
+GinkgoLabelFilter() returns the label filter configured for this suite via `--label-filter`.
+
+You can use this to manually check if a set of labels would satisfy the filter via:
+
+ if (Label("cat", "dog").MatchesLabelFilter(GinkgoLabelFilter())) {
+ //...
+ }
+*/
+func GinkgoLabelFilter() string {
+ suiteConfig, _ := GinkgoConfiguration()
+ return suiteConfig.LabelFilter
+}
+
/*
PauseOutputInterception() pauses Ginkgo's output interception. This is only relevant
when running in parallel and output to stdout/stderr is being intercepted. You generally
@@ -369,6 +392,12 @@ func AbortSuite(message string, callerSkip ...int) {
panic(types.GinkgoErrors.UncaughtGinkgoPanic(cl))
}
+/*
+ignorablePanic is used by Gomega to signal to GinkgoRecover that Goemga is handling
+the error associated with this panic. It i used when Eventually/Consistently are passed a func(g Gomega) and the resulting function launches a goroutines that makes a failed assertion. That failed assertion is registered by Gomega and then panics. Ordinarily the panic is captured by Gomega. In the case of a goroutine Gomega can't capture the panic - so we piggy back on GinkgoRecover so users have a single defer GinkgoRecover() pattern to follow. To do that we need to tell Ginkgo to ignore this panic and not register it as a panic on the global Failer.
+*/
+type ignorablePanic interface{ GinkgoRecoverShouldIgnoreThisPanic() }
+
/*
GinkgoRecover should be deferred at the top of any spawned goroutine that (may) call `Fail`
Since Gomega assertions call fail, you should throw a `defer GinkgoRecover()` at the top of any goroutine that
@@ -384,6 +413,9 @@ You can learn more about how Ginkgo manages failures here: https://onsi.github.i
func GinkgoRecover() {
e := recover()
if e != nil {
+ if _, ok := e.(ignorablePanic); ok {
+ return
+ }
global.Failer.Panic(types.NewCodeLocationWithStackTrace(1), e)
}
}
@@ -711,7 +743,7 @@ For example:
os.SetEnv("FOO", "BAR")
})
-will register a cleanup handler that will set the environment variable "FOO" to it's current value (obtained by os.GetEnv("FOO")) after the spec runs and then sets the environment variable "FOO" to "BAR" for the current spec.
+will register a cleanup handler that will set the environment variable "FOO" to its current value (obtained by os.GetEnv("FOO")) after the spec runs and then sets the environment variable "FOO" to "BAR" for the current spec.
Similarly:
diff --git a/vendor/github.com/onsi/ginkgo/v2/decorator_dsl.go b/vendor/github.com/onsi/ginkgo/v2/decorator_dsl.go
index e43d9cbb..c65af4ce 100644
--- a/vendor/github.com/onsi/ginkgo/v2/decorator_dsl.go
+++ b/vendor/github.com/onsi/ginkgo/v2/decorator_dsl.go
@@ -46,7 +46,7 @@ const Pending = internal.Pending
/*
Serial is a decorator that allows you to mark a spec or container as serial. These specs will never run in parallel with other specs.
-Tests in ordered containers cannot be marked as serial - mark the ordered container instead.
+Specs in ordered containers cannot be marked as serial - mark the ordered container instead.
You can learn more here: https://onsi.github.io/ginkgo/#serial-specs
You can learn more about decorators here: https://onsi.github.io/ginkgo/#decorator-reference
@@ -54,7 +54,7 @@ You can learn more about decorators here: https://onsi.github.io/ginkgo/#decorat
const Serial = internal.Serial
/*
-Ordered is a decorator that allows you to mark a container as ordered. Tests in the container will always run in the order they appear.
+Ordered is a decorator that allows you to mark a container as ordered. Specs in the container will always run in the order they appear.
They will never be randomized and they will never run in parallel with one another, though they may run in parallel with other specs.
You can learn more here: https://onsi.github.io/ginkgo/#ordered-containers
@@ -62,6 +62,16 @@ You can learn more about decorators here: https://onsi.github.io/ginkgo/#decorat
*/
const Ordered = internal.Ordered
+/*
+ContinueOnFailure is a decorator that allows you to mark an Ordered container to continue running specs even if failures occur. Ordinarily an ordered container will stop running specs after the first failure occurs. Note that if a BeforeAll or a BeforeEach/JustBeforeEach annotated with OncePerOrdered fails then no specs will run as the precondition for the Ordered container will consider to be failed.
+
+ContinueOnFailure only applies to the outermost Ordered container. Attempting to place ContinueOnFailure in a nested container will result in an error.
+
+You can learn more here: https://onsi.github.io/ginkgo/#ordered-containers
+You can learn more about decorators here: https://onsi.github.io/ginkgo/#decorator-reference
+*/
+const ContinueOnFailure = internal.ContinueOnFailure
+
/*
OncePerOrdered is a decorator that allows you to mark outer BeforeEach, AfterEach, JustBeforeEach, and JustAfterEach setup nodes to run once
per ordered context. Normally these setup nodes run around each individual spec, with OncePerOrdered they will run once around the set of specs in an ordered container.
diff --git a/vendor/github.com/onsi/ginkgo/v2/formatter/formatter.go b/vendor/github.com/onsi/ginkgo/v2/formatter/formatter.go
index 43b16211..743555dd 100644
--- a/vendor/github.com/onsi/ginkgo/v2/formatter/formatter.go
+++ b/vendor/github.com/onsi/ginkgo/v2/formatter/formatter.go
@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"regexp"
+ "strconv"
"strings"
)
@@ -50,6 +51,37 @@ func NewWithNoColorBool(noColor bool) Formatter {
}
func New(colorMode ColorMode) Formatter {
+ colorAliases := map[string]int{
+ "black": 0,
+ "red": 1,
+ "green": 2,
+ "yellow": 3,
+ "blue": 4,
+ "magenta": 5,
+ "cyan": 6,
+ "white": 7,
+ }
+ for colorAlias, n := range colorAliases {
+ colorAliases[fmt.Sprintf("bright-%s", colorAlias)] = n + 8
+ }
+
+ getColor := func(color, defaultEscapeCode string) string {
+ color = strings.ToUpper(strings.ReplaceAll(color, "-", "_"))
+ envVar := fmt.Sprintf("GINKGO_CLI_COLOR_%s", color)
+ envVarColor := os.Getenv(envVar)
+ if envVarColor == "" {
+ return defaultEscapeCode
+ }
+ if colorCode, ok := colorAliases[envVarColor]; ok {
+ return fmt.Sprintf("\x1b[38;5;%dm", colorCode)
+ }
+ colorCode, err := strconv.Atoi(envVarColor)
+ if err != nil || colorCode < 0 || colorCode > 255 {
+ return defaultEscapeCode
+ }
+ return fmt.Sprintf("\x1b[38;5;%dm", colorCode)
+ }
+
f := Formatter{
ColorMode: colorMode,
colors: map[string]string{
@@ -57,18 +89,18 @@ func New(colorMode ColorMode) Formatter {
"bold": "\x1b[1m",
"underline": "\x1b[4m",
- "red": "\x1b[38;5;9m",
- "orange": "\x1b[38;5;214m",
- "coral": "\x1b[38;5;204m",
- "magenta": "\x1b[38;5;13m",
- "green": "\x1b[38;5;10m",
- "dark-green": "\x1b[38;5;28m",
- "yellow": "\x1b[38;5;11m",
- "light-yellow": "\x1b[38;5;228m",
- "cyan": "\x1b[38;5;14m",
- "gray": "\x1b[38;5;243m",
- "light-gray": "\x1b[38;5;246m",
- "blue": "\x1b[38;5;12m",
+ "red": getColor("red", "\x1b[38;5;9m"),
+ "orange": getColor("orange", "\x1b[38;5;214m"),
+ "coral": getColor("coral", "\x1b[38;5;204m"),
+ "magenta": getColor("magenta", "\x1b[38;5;13m"),
+ "green": getColor("green", "\x1b[38;5;10m"),
+ "dark-green": getColor("dark-green", "\x1b[38;5;28m"),
+ "yellow": getColor("yellow", "\x1b[38;5;11m"),
+ "light-yellow": getColor("light-yellow", "\x1b[38;5;228m"),
+ "cyan": getColor("cyan", "\x1b[38;5;14m"),
+ "gray": getColor("gray", "\x1b[38;5;243m"),
+ "light-gray": getColor("light-gray", "\x1b[38;5;246m"),
+ "blue": getColor("blue", "\x1b[38;5;12m"),
},
}
colors := []string{}
@@ -88,7 +120,10 @@ func (f Formatter) Fi(indentation uint, format string, args ...interface{}) stri
}
func (f Formatter) Fiw(indentation uint, maxWidth uint, format string, args ...interface{}) string {
- out := fmt.Sprintf(f.style(format), args...)
+ out := f.style(format)
+ if len(args) > 0 {
+ out = fmt.Sprintf(out, args...)
+ }
if indentation == 0 && maxWidth == 0 {
return out
diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/bootstrap_command.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/bootstrap_command.go
index 0273abe9..73aff0b7 100644
--- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/bootstrap_command.go
+++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/bootstrap_command.go
@@ -2,6 +2,7 @@ package generators
import (
"bytes"
+ "encoding/json"
"fmt"
"os"
"text/template"
@@ -25,6 +26,9 @@ func BuildBootstrapCommand() command.Command {
{Name: "template", KeyPath: "CustomTemplate",
UsageArgument: "template-file",
Usage: "If specified, generate will use the contents of the file passed as the bootstrap template"},
+ {Name: "template-data", KeyPath: "CustomTemplateData",
+ UsageArgument: "template-data-file",
+ Usage: "If specified, generate will use the contents of the file passed as data to be rendered in the bootstrap template"},
},
&conf,
types.GinkgoFlagSections{},
@@ -57,6 +61,7 @@ type bootstrapData struct {
GomegaImport string
GinkgoPackage string
GomegaPackage string
+ CustomData map[string]any
}
func generateBootstrap(conf GeneratorsConfig) {
@@ -95,17 +100,32 @@ func generateBootstrap(conf GeneratorsConfig) {
tpl, err := os.ReadFile(conf.CustomTemplate)
command.AbortIfError("Failed to read custom bootstrap file:", err)
templateText = string(tpl)
+ if conf.CustomTemplateData != "" {
+ var tplCustomDataMap map[string]any
+ tplCustomData, err := os.ReadFile(conf.CustomTemplateData)
+ command.AbortIfError("Failed to read custom boostrap data file:", err)
+ if !json.Valid([]byte(tplCustomData)) {
+ command.AbortWith("Invalid JSON object in custom data file.")
+ }
+ //create map from the custom template data
+ json.Unmarshal(tplCustomData, &tplCustomDataMap)
+ data.CustomData = tplCustomDataMap
+ }
} else if conf.Agouti {
templateText = agoutiBootstrapText
} else {
templateText = bootstrapText
}
- bootstrapTemplate, err := template.New("bootstrap").Funcs(sprig.TxtFuncMap()).Parse(templateText)
+ //Setting the option to explicitly fail if template is rendered trying to access missing key
+ bootstrapTemplate, err := template.New("bootstrap").Funcs(sprig.TxtFuncMap()).Option("missingkey=error").Parse(templateText)
command.AbortIfError("Failed to parse bootstrap template:", err)
buf := &bytes.Buffer{}
- bootstrapTemplate.Execute(buf, data)
+ //Being explicit about failing sooner during template rendering
+ //when accessing custom data rather than during the go fmt command
+ err = bootstrapTemplate.Execute(buf, data)
+ command.AbortIfError("Failed to render bootstrap template:", err)
buf.WriteTo(f)
diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generate_command.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generate_command.go
index 93b0b4b2..48d23f91 100644
--- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generate_command.go
+++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generate_command.go
@@ -2,6 +2,7 @@ package generators
import (
"bytes"
+ "encoding/json"
"fmt"
"os"
"path/filepath"
@@ -28,6 +29,9 @@ func BuildGenerateCommand() command.Command {
{Name: "template", KeyPath: "CustomTemplate",
UsageArgument: "template-file",
Usage: "If specified, generate will use the contents of the file passed as the test file template"},
+ {Name: "template-data", KeyPath: "CustomTemplateData",
+ UsageArgument: "template-data-file",
+ Usage: "If specified, generate will use the contents of the file passed as data to be rendered in the test file template"},
},
&conf,
types.GinkgoFlagSections{},
@@ -64,6 +68,7 @@ type specData struct {
GomegaImport string
GinkgoPackage string
GomegaPackage string
+ CustomData map[string]any
}
func generateTestFiles(conf GeneratorsConfig, args []string) {
@@ -122,16 +127,31 @@ func generateTestFileForSubject(subject string, conf GeneratorsConfig) {
tpl, err := os.ReadFile(conf.CustomTemplate)
command.AbortIfError("Failed to read custom template file:", err)
templateText = string(tpl)
+ if conf.CustomTemplateData != "" {
+ var tplCustomDataMap map[string]any
+ tplCustomData, err := os.ReadFile(conf.CustomTemplateData)
+ command.AbortIfError("Failed to read custom template data file:", err)
+ if !json.Valid([]byte(tplCustomData)) {
+ command.AbortWith("Invalid JSON object in custom data file.")
+ }
+ //create map from the custom template data
+ json.Unmarshal(tplCustomData, &tplCustomDataMap)
+ data.CustomData = tplCustomDataMap
+ }
} else if conf.Agouti {
templateText = agoutiSpecText
} else {
templateText = specText
}
- specTemplate, err := template.New("spec").Funcs(sprig.TxtFuncMap()).Parse(templateText)
+ //Setting the option to explicitly fail if template is rendered trying to access missing key
+ specTemplate, err := template.New("spec").Funcs(sprig.TxtFuncMap()).Option("missingkey=error").Parse(templateText)
command.AbortIfError("Failed to read parse test template:", err)
- specTemplate.Execute(f, data)
+ //Being explicit about failing sooner during template rendering
+ //when accessing custom data rather than during the go fmt command
+ err = specTemplate.Execute(f, data)
+ command.AbortIfError("Failed to render bootstrap template:", err)
internal.GoFmt(targetFile)
}
diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generators_common.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generators_common.go
index 3086e605..3046a448 100644
--- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generators_common.go
+++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generators_common.go
@@ -13,6 +13,7 @@ import (
type GeneratorsConfig struct {
Agouti, NoDot, Internal bool
CustomTemplate string
+ CustomTemplateData string
}
func getPackageAndFormattedName() (string, string, string) {
diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/run.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/run.go
index cad23867..41052ea1 100644
--- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/run.go
+++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/run.go
@@ -6,6 +6,7 @@ import (
"io"
"os"
"os/exec"
+ "path/filepath"
"regexp"
"strings"
"syscall"
@@ -63,6 +64,12 @@ func checkForNoTestsWarning(buf *bytes.Buffer) bool {
}
func runGoTest(suite TestSuite, cliConfig types.CLIConfig, goFlagsConfig types.GoFlagsConfig) TestSuite {
+ // As we run the go test from the suite directory, make sure the cover profile is absolute
+ // and placed into the expected output directory when one is configured.
+ if goFlagsConfig.Cover && !filepath.IsAbs(goFlagsConfig.CoverProfile) {
+ goFlagsConfig.CoverProfile = AbsPathForGeneratedAsset(goFlagsConfig.CoverProfile, suite, cliConfig, 0)
+ }
+
args, err := types.GenerateGoTestRunArgs(goFlagsConfig)
command.AbortIfError("Failed to generate test run arguments", err)
cmd, buf := buildAndStartCommand(suite, args, true)
diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/outline/ginkgo.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/outline/ginkgo.go
index c197bb68..0b9b19fe 100644
--- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/outline/ginkgo.go
+++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/outline/ginkgo.go
@@ -1,6 +1,7 @@
package outline
import (
+ "github.com/onsi/ginkgo/v2/types"
"go/ast"
"go/token"
"strconv"
@@ -25,9 +26,10 @@ type ginkgoMetadata struct {
// End is the position of first character immediately after the spec or container block
End int `json:"end"`
- Spec bool `json:"spec"`
- Focused bool `json:"focused"`
- Pending bool `json:"pending"`
+ Spec bool `json:"spec"`
+ Focused bool `json:"focused"`
+ Pending bool `json:"pending"`
+ Labels []string `json:"labels"`
}
// ginkgoNode is used to construct the outline as a tree
@@ -145,27 +147,35 @@ func ginkgoNodeFromCallExpr(fset *token.FileSet, ce *ast.CallExpr, ginkgoPackage
case "It", "Specify", "Entry":
n.Spec = true
n.Text = textOrAltFromCallExpr(ce, undefinedTextAlt)
+ n.Labels = labelFromCallExpr(ce)
+ n.Pending = pendingFromCallExpr(ce)
return &n, ginkgoPackageName != nil && *ginkgoPackageName == packageName
case "FIt", "FSpecify", "FEntry":
n.Spec = true
n.Focused = true
n.Text = textOrAltFromCallExpr(ce, undefinedTextAlt)
+ n.Labels = labelFromCallExpr(ce)
return &n, ginkgoPackageName != nil && *ginkgoPackageName == packageName
case "PIt", "PSpecify", "XIt", "XSpecify", "PEntry", "XEntry":
n.Spec = true
n.Pending = true
n.Text = textOrAltFromCallExpr(ce, undefinedTextAlt)
+ n.Labels = labelFromCallExpr(ce)
return &n, ginkgoPackageName != nil && *ginkgoPackageName == packageName
case "Context", "Describe", "When", "DescribeTable":
n.Text = textOrAltFromCallExpr(ce, undefinedTextAlt)
+ n.Labels = labelFromCallExpr(ce)
+ n.Pending = pendingFromCallExpr(ce)
return &n, ginkgoPackageName != nil && *ginkgoPackageName == packageName
case "FContext", "FDescribe", "FWhen", "FDescribeTable":
n.Focused = true
n.Text = textOrAltFromCallExpr(ce, undefinedTextAlt)
+ n.Labels = labelFromCallExpr(ce)
return &n, ginkgoPackageName != nil && *ginkgoPackageName == packageName
case "PContext", "PDescribe", "PWhen", "XContext", "XDescribe", "XWhen", "PDescribeTable", "XDescribeTable":
n.Pending = true
n.Text = textOrAltFromCallExpr(ce, undefinedTextAlt)
+ n.Labels = labelFromCallExpr(ce)
return &n, ginkgoPackageName != nil && *ginkgoPackageName == packageName
case "By":
n.Text = textOrAltFromCallExpr(ce, undefinedTextAlt)
@@ -216,3 +226,77 @@ func textFromCallExpr(ce *ast.CallExpr) (string, bool) {
return text.Value, true
}
}
+
+func labelFromCallExpr(ce *ast.CallExpr) []string {
+
+ labels := []string{}
+ if len(ce.Args) < 2 {
+ return labels
+ }
+
+ for _, arg := range ce.Args[1:] {
+ switch expr := arg.(type) {
+ case *ast.CallExpr:
+ id, ok := expr.Fun.(*ast.Ident)
+ if !ok {
+ // to skip over cases where the expr.Fun. is actually *ast.SelectorExpr
+ continue
+ }
+ if id.Name == "Label" {
+ ls := extractLabels(expr)
+ for _, label := range ls {
+ labels = append(labels, label)
+ }
+ }
+ }
+ }
+ return labels
+}
+
+func extractLabels(expr *ast.CallExpr) []string {
+ out := []string{}
+ for _, arg := range expr.Args {
+ switch expr := arg.(type) {
+ case *ast.BasicLit:
+ if expr.Kind == token.STRING {
+ unquoted, err := strconv.Unquote(expr.Value)
+ if err != nil {
+ unquoted = expr.Value
+ }
+ validated, err := types.ValidateAndCleanupLabel(unquoted, types.CodeLocation{})
+ if err == nil {
+ out = append(out, validated)
+ }
+ }
+ }
+ }
+
+ return out
+}
+
+func pendingFromCallExpr(ce *ast.CallExpr) bool {
+
+ pending := false
+ if len(ce.Args) < 2 {
+ return pending
+ }
+
+ for _, arg := range ce.Args[1:] {
+ switch expr := arg.(type) {
+ case *ast.CallExpr:
+ id, ok := expr.Fun.(*ast.Ident)
+ if !ok {
+ // to skip over cases where the expr.Fun. is actually *ast.SelectorExpr
+ continue
+ }
+ if id.Name == "Pending" {
+ pending = true
+ }
+ case *ast.Ident:
+ if expr.Name == "Pending" {
+ pending = true
+ }
+ }
+ }
+ return pending
+}
diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/outline/outline.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/outline/outline.go
index 4b45e762..c2327cda 100644
--- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/outline/outline.go
+++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/outline/outline.go
@@ -85,12 +85,19 @@ func (o *outline) String() string {
// one 'width' of spaces for every level of nesting.
func (o *outline) StringIndent(width int) string {
var b strings.Builder
- b.WriteString("Name,Text,Start,End,Spec,Focused,Pending\n")
+ b.WriteString("Name,Text,Start,End,Spec,Focused,Pending,Labels\n")
currentIndent := 0
pre := func(n *ginkgoNode) {
b.WriteString(fmt.Sprintf("%*s", currentIndent, ""))
- b.WriteString(fmt.Sprintf("%s,%s,%d,%d,%t,%t,%t\n", n.Name, n.Text, n.Start, n.End, n.Spec, n.Focused, n.Pending))
+ var labels string
+ if len(n.Labels) == 1 {
+ labels = n.Labels[0]
+ } else {
+ labels = strings.Join(n.Labels, ", ")
+ }
+ //enclosing labels in a double quoted comma separate listed so that when inmported into a CSV app the Labels column has comma separate strings
+ b.WriteString(fmt.Sprintf("%s,%s,%d,%d,%t,%t,%t,\"%s\"\n", n.Name, n.Text, n.Start, n.End, n.Spec, n.Focused, n.Pending, labels))
currentIndent += width
}
post := func(n *ginkgoNode) {
diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo_t_dsl.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo_t_dsl.go
index 1beeb114..c5a7eb94 100644
--- a/vendor/github.com/onsi/ginkgo/v2/ginkgo_t_dsl.go
+++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo_t_dsl.go
@@ -7,7 +7,7 @@ GinkgoT() implements an interface analogous to *testing.T and can be used with
third-party libraries that accept *testing.T through an interface.
GinkgoT() takes an optional offset argument that can be used to get the
-correct line number associated with the failure.
+correct line number associated with the failure - though you do not need to use this if you call GinkgoHelper() or GinkgoT().Helper() appropriately
You can learn more here: https://onsi.github.io/ginkgo/#using-third-party-libraries
*/
diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/group.go b/vendor/github.com/onsi/ginkgo/v2/internal/group.go
index 5c782d3f..ae1b7b01 100644
--- a/vendor/github.com/onsi/ginkgo/v2/internal/group.go
+++ b/vendor/github.com/onsi/ginkgo/v2/internal/group.go
@@ -94,15 +94,19 @@ type group struct {
runOncePairs map[uint]runOncePairs
runOnceTracker map[runOncePair]types.SpecState
- succeeded bool
+ succeeded bool
+ failedInARunOnceBefore bool
+ continueOnFailure bool
}
func newGroup(suite *Suite) *group {
return &group{
- suite: suite,
- runOncePairs: map[uint]runOncePairs{},
- runOnceTracker: map[runOncePair]types.SpecState{},
- succeeded: true,
+ suite: suite,
+ runOncePairs: map[uint]runOncePairs{},
+ runOnceTracker: map[runOncePair]types.SpecState{},
+ succeeded: true,
+ failedInARunOnceBefore: false,
+ continueOnFailure: false,
}
}
@@ -137,10 +141,14 @@ func (g *group) evaluateSkipStatus(spec Spec) (types.SpecState, types.Failure) {
if !g.suite.deadline.IsZero() && g.suite.deadline.Before(time.Now()) {
return types.SpecStateSkipped, types.Failure{}
}
- if !g.succeeded {
+ if !g.succeeded && !g.continueOnFailure {
return types.SpecStateSkipped, g.suite.failureForLeafNodeWithMessage(spec.FirstNodeWithType(types.NodeTypeIt),
"Spec skipped because an earlier spec in an ordered container failed")
}
+ if g.failedInARunOnceBefore && g.continueOnFailure {
+ return types.SpecStateSkipped, g.suite.failureForLeafNodeWithMessage(spec.FirstNodeWithType(types.NodeTypeIt),
+ "Spec skipped because a BeforeAll node failed")
+ }
beforeOncePairs := g.runOncePairs[spec.SubjectID()].withType(types.NodeTypeBeforeAll | types.NodeTypeBeforeEach | types.NodeTypeJustBeforeEach)
for _, pair := range beforeOncePairs {
if g.runOnceTracker[pair].Is(types.SpecStateSkipped) {
@@ -168,7 +176,8 @@ func (g *group) isLastSpecWithPair(specID uint, pair runOncePair) bool {
return lastSpecID == specID
}
-func (g *group) attemptSpec(isFinalAttempt bool, spec Spec) {
+func (g *group) attemptSpec(isFinalAttempt bool, spec Spec) bool {
+ failedInARunOnceBefore := false
pairs := g.runOncePairs[spec.SubjectID()]
nodes := spec.Nodes.WithType(types.NodeTypeBeforeAll)
@@ -194,6 +203,7 @@ func (g *group) attemptSpec(isFinalAttempt bool, spec Spec) {
}
if g.suite.currentSpecReport.State != types.SpecStatePassed {
terminatingNode, terminatingPair = node, oncePair
+ failedInARunOnceBefore = !terminatingPair.isZero()
break
}
}
@@ -216,7 +226,7 @@ func (g *group) attemptSpec(isFinalAttempt bool, spec Spec) {
//this node has already been run on this attempt, don't rerun it
return false
}
- pair := runOncePair{}
+ var pair runOncePair
switch node.NodeType {
case types.NodeTypeCleanupAfterEach, types.NodeTypeCleanupAfterAll:
// check if we were generated in an AfterNode that has already run
@@ -246,9 +256,13 @@ func (g *group) attemptSpec(isFinalAttempt bool, spec Spec) {
if !terminatingPair.isZero() && terminatingNode.NestingLevel == node.NestingLevel {
return true //...or, a run-once node at our nesting level was skipped which means this is our last chance to run
}
- case types.SpecStateFailed, types.SpecStatePanicked: // the spec has failed...
+ case types.SpecStateFailed, types.SpecStatePanicked, types.SpecStateTimedout: // the spec has failed...
if isFinalAttempt {
- return true //...if this was the last attempt then we're the last spec to run and so the AfterNode should run
+ if g.continueOnFailure {
+ return isLastSpecWithPair || failedInARunOnceBefore //...we're configured to continue on failures - so we should only run if we're the last spec for this pair or if we failed in a runOnceBefore (which means we _are_ the last spec to run)
+ } else {
+ return true //...this was the last attempt and continueOnFailure is false therefore we are the last spec to run and so the AfterNode should run
+ }
}
if !terminatingPair.isZero() { // ...and it failed in a run-once. which will be running again
if node.NodeType.Is(types.NodeTypeCleanupAfterEach | types.NodeTypeCleanupAfterAll) {
@@ -281,10 +295,12 @@ func (g *group) attemptSpec(isFinalAttempt bool, spec Spec) {
includeDeferCleanups = true
}
+ return failedInARunOnceBefore
}
func (g *group) run(specs Specs) {
g.specs = specs
+ g.continueOnFailure = specs[0].Nodes.FirstNodeMarkedOrdered().MarkedContinueOnFailure
for _, spec := range g.specs {
g.runOncePairs[spec.SubjectID()] = runOncePairsForSpec(spec)
}
@@ -301,8 +317,8 @@ func (g *group) run(specs Specs) {
skip := g.suite.config.DryRun || g.suite.currentSpecReport.State.Is(types.SpecStateFailureStates|types.SpecStateSkipped|types.SpecStatePending)
g.suite.currentSpecReport.StartTime = time.Now()
+ failedInARunOnceBefore := false
if !skip {
-
var maxAttempts = 1
if g.suite.currentSpecReport.MaxMustPassRepeatedly > 0 {
@@ -327,7 +343,7 @@ func (g *group) run(specs Specs) {
}
}
- g.attemptSpec(attempt == maxAttempts-1, spec)
+ failedInARunOnceBefore = g.attemptSpec(attempt == maxAttempts-1, spec)
g.suite.currentSpecReport.EndTime = time.Now()
g.suite.currentSpecReport.RunTime = g.suite.currentSpecReport.EndTime.Sub(g.suite.currentSpecReport.StartTime)
@@ -355,6 +371,7 @@ func (g *group) run(specs Specs) {
g.suite.processCurrentSpecReport()
if g.suite.currentSpecReport.State.Is(types.SpecStateFailureStates) {
g.succeeded = false
+ g.failedInARunOnceBefore = g.failedInARunOnceBefore || failedInARunOnceBefore
}
g.suite.selectiveLock.Lock()
g.suite.currentSpecReport = types.SpecReport{}
diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/node.go b/vendor/github.com/onsi/ginkgo/v2/internal/node.go
index 0878c672..0869bffb 100644
--- a/vendor/github.com/onsi/ginkgo/v2/internal/node.go
+++ b/vendor/github.com/onsi/ginkgo/v2/internal/node.go
@@ -44,22 +44,23 @@ type Node struct {
SynchronizedAfterSuiteProc1Body func(SpecContext)
SynchronizedAfterSuiteProc1BodyHasContext bool
- ReportEachBody func(types.SpecReport)
- ReportAfterSuiteBody func(types.Report)
-
- MarkedFocus bool
- MarkedPending bool
- MarkedSerial bool
- MarkedOrdered bool
- MarkedOncePerOrdered bool
- FlakeAttempts int
- MustPassRepeatedly int
- Labels Labels
- PollProgressAfter time.Duration
- PollProgressInterval time.Duration
- NodeTimeout time.Duration
- SpecTimeout time.Duration
- GracePeriod time.Duration
+ ReportEachBody func(types.SpecReport)
+ ReportSuiteBody func(types.Report)
+
+ MarkedFocus bool
+ MarkedPending bool
+ MarkedSerial bool
+ MarkedOrdered bool
+ MarkedContinueOnFailure bool
+ MarkedOncePerOrdered bool
+ FlakeAttempts int
+ MustPassRepeatedly int
+ Labels Labels
+ PollProgressAfter time.Duration
+ PollProgressInterval time.Duration
+ NodeTimeout time.Duration
+ SpecTimeout time.Duration
+ GracePeriod time.Duration
NodeIDWhereCleanupWasGenerated uint
}
@@ -69,6 +70,7 @@ type focusType bool
type pendingType bool
type serialType bool
type orderedType bool
+type continueOnFailureType bool
type honorsOrderedType bool
type suppressProgressReporting bool
@@ -76,6 +78,7 @@ const Focus = focusType(true)
const Pending = pendingType(true)
const Serial = serialType(true)
const Ordered = orderedType(true)
+const ContinueOnFailure = continueOnFailureType(true)
const OncePerOrdered = honorsOrderedType(true)
const SuppressProgressReporting = suppressProgressReporting(true)
@@ -90,6 +93,10 @@ type NodeTimeout time.Duration
type SpecTimeout time.Duration
type GracePeriod time.Duration
+func (l Labels) MatchesLabelFilter(query string) bool {
+ return types.MustParseLabelFilter(query)(l)
+}
+
func UnionOfLabels(labels ...Labels) Labels {
out := Labels{}
seen := map[string]bool{}
@@ -133,6 +140,8 @@ func isDecoration(arg interface{}) bool {
return true
case t == reflect.TypeOf(Ordered):
return true
+ case t == reflect.TypeOf(ContinueOnFailure):
+ return true
case t == reflect.TypeOf(OncePerOrdered):
return true
case t == reflect.TypeOf(SuppressProgressReporting):
@@ -241,6 +250,11 @@ func NewNode(deprecationTracker *types.DeprecationTracker, nodeType types.NodeTy
if !nodeType.Is(types.NodeTypeContainer) {
appendError(types.GinkgoErrors.InvalidDecoratorForNodeType(node.CodeLocation, nodeType, "Ordered"))
}
+ case t == reflect.TypeOf(ContinueOnFailure):
+ node.MarkedContinueOnFailure = bool(arg.(continueOnFailureType))
+ if !nodeType.Is(types.NodeTypeContainer) {
+ appendError(types.GinkgoErrors.InvalidDecoratorForNodeType(node.CodeLocation, nodeType, "ContinueOnFailure"))
+ }
case t == reflect.TypeOf(OncePerOrdered):
node.MarkedOncePerOrdered = bool(arg.(honorsOrderedType))
if !nodeType.Is(types.NodeTypeBeforeEach | types.NodeTypeJustBeforeEach | types.NodeTypeAfterEach | types.NodeTypeJustAfterEach) {
@@ -317,9 +331,9 @@ func NewNode(deprecationTracker *types.DeprecationTracker, nodeType types.NodeTy
trackedFunctionError = true
break
}
- } else if nodeType.Is(types.NodeTypeReportAfterSuite) {
- if node.ReportAfterSuiteBody == nil {
- node.ReportAfterSuiteBody = arg.(func(types.Report))
+ } else if nodeType.Is(types.NodeTypeReportBeforeSuite | types.NodeTypeReportAfterSuite) {
+ if node.ReportSuiteBody == nil {
+ node.ReportSuiteBody = arg.(func(types.Report))
} else {
appendError(types.GinkgoErrors.MultipleBodyFunctions(node.CodeLocation, nodeType))
trackedFunctionError = true
@@ -386,13 +400,17 @@ func NewNode(deprecationTracker *types.DeprecationTracker, nodeType types.NodeTy
appendError(types.GinkgoErrors.InvalidDeclarationOfFocusedAndPending(node.CodeLocation, nodeType))
}
+ if node.MarkedContinueOnFailure && !node.MarkedOrdered {
+ appendError(types.GinkgoErrors.InvalidContinueOnFailureDecoration(node.CodeLocation))
+ }
+
hasContext := node.HasContext || node.SynchronizedAfterSuiteProc1BodyHasContext || node.SynchronizedAfterSuiteAllProcsBodyHasContext || node.SynchronizedBeforeSuiteProc1BodyHasContext || node.SynchronizedBeforeSuiteAllProcsBodyHasContext
if !hasContext && (node.NodeTimeout > 0 || node.SpecTimeout > 0 || node.GracePeriod > 0) && len(errors) == 0 {
appendError(types.GinkgoErrors.InvalidTimeoutOrGracePeriodForNonContextNode(node.CodeLocation, nodeType))
}
- if !node.NodeType.Is(types.NodeTypeReportBeforeEach|types.NodeTypeReportAfterEach|types.NodeTypeSynchronizedBeforeSuite|types.NodeTypeSynchronizedAfterSuite|types.NodeTypeReportAfterSuite) && node.Body == nil && !node.MarkedPending && !trackedFunctionError {
+ if !node.NodeType.Is(types.NodeTypeReportBeforeEach|types.NodeTypeReportAfterEach|types.NodeTypeSynchronizedBeforeSuite|types.NodeTypeSynchronizedAfterSuite|types.NodeTypeReportBeforeSuite|types.NodeTypeReportAfterSuite) && node.Body == nil && !node.MarkedPending && !trackedFunctionError {
appendError(types.GinkgoErrors.MissingBodyFunction(node.CodeLocation, nodeType))
}
diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/ordering.go b/vendor/github.com/onsi/ginkgo/v2/internal/ordering.go
index 161be820..7ed43c7f 100644
--- a/vendor/github.com/onsi/ginkgo/v2/internal/ordering.go
+++ b/vendor/github.com/onsi/ginkgo/v2/internal/ordering.go
@@ -7,6 +7,58 @@ import (
"github.com/onsi/ginkgo/v2/types"
)
+type SortableSpecs struct {
+ Specs Specs
+ Indexes []int
+}
+
+func NewSortableSpecs(specs Specs) *SortableSpecs {
+ indexes := make([]int, len(specs))
+ for i := range specs {
+ indexes[i] = i
+ }
+ return &SortableSpecs{
+ Specs: specs,
+ Indexes: indexes,
+ }
+}
+func (s *SortableSpecs) Len() int { return len(s.Indexes) }
+func (s *SortableSpecs) Swap(i, j int) { s.Indexes[i], s.Indexes[j] = s.Indexes[j], s.Indexes[i] }
+func (s *SortableSpecs) Less(i, j int) bool {
+ a, b := s.Specs[s.Indexes[i]], s.Specs[s.Indexes[j]]
+
+ firstOrderedA := a.Nodes.FirstNodeMarkedOrdered()
+ firstOrderedB := b.Nodes.FirstNodeMarkedOrdered()
+ if firstOrderedA.ID == firstOrderedB.ID && !firstOrderedA.IsZero() {
+ // strictly preserve order in ordered containers. ID will track this as IDs are generated monotonically
+ return a.FirstNodeWithType(types.NodeTypeIt).ID < b.FirstNodeWithType(types.NodeTypeIt).ID
+ }
+
+ aCLs := a.Nodes.WithType(types.NodeTypesForContainerAndIt).CodeLocations()
+ bCLs := b.Nodes.WithType(types.NodeTypesForContainerAndIt).CodeLocations()
+ for i := 0; i < len(aCLs) && i < len(bCLs); i++ {
+ aCL, bCL := aCLs[i], bCLs[i]
+ if aCL.FileName < bCL.FileName {
+ return true
+ } else if aCL.FileName > bCL.FileName {
+ return false
+ }
+ if aCL.LineNumber < bCL.LineNumber {
+ return true
+ } else if aCL.LineNumber > bCL.LineNumber {
+ return false
+ }
+ }
+ // either everything is equal or we have different lengths of CLs
+ if len(aCLs) < len(bCLs) {
+ return true
+ } else if len(aCLs) > len(bCLs) {
+ return false
+ }
+ // ok, now we are sure everything was equal. so we use the spec text to break ties
+ return a.Text() < b.Text()
+}
+
type GroupedSpecIndices []SpecIndices
type SpecIndices []int
@@ -28,12 +80,17 @@ func OrderSpecs(specs Specs, suiteConfig types.SuiteConfig) (GroupedSpecIndices,
// Seed a new random source based on thee configured random seed.
r := rand.New(rand.NewSource(suiteConfig.RandomSeed))
- // first break things into execution groups
+ // first, we sort the entire suite to ensure a deterministic order. the sort is performed by filename, then line number, and then spec text. this ensures every parallel process has the exact same spec order and is only necessary to cover the edge case where the user iterates over a map to generate specs.
+ sortableSpecs := NewSortableSpecs(specs)
+ sort.Sort(sortableSpecs)
+
+ // then we break things into execution groups
// a group represents a single unit of execution and is a collection of SpecIndices
// usually a group is just a single spec, however ordered containers must be preserved as a single group
executionGroupIDs := []uint{}
executionGroups := map[uint]SpecIndices{}
- for idx, spec := range specs {
+ for _, idx := range sortableSpecs.Indexes {
+ spec := specs[idx]
groupNode := spec.Nodes.FirstNodeMarkedOrdered()
if groupNode.IsZero() {
groupNode = spec.Nodes.FirstNodeWithType(types.NodeTypeIt)
@@ -48,7 +105,6 @@ func OrderSpecs(specs Specs, suiteConfig types.SuiteConfig) (GroupedSpecIndices,
// we shuffle outermost containers. so we need to form shufflable groupings of GroupIDs
shufflableGroupingIDs := []uint{}
shufflableGroupingIDToGroupIDs := map[uint][]uint{}
- shufflableGroupingsIDToSortKeys := map[uint]string{}
// for each execution group we're going to have to pick a node to represent how the
// execution group is grouped for shuffling:
@@ -57,7 +113,7 @@ func OrderSpecs(specs Specs, suiteConfig types.SuiteConfig) (GroupedSpecIndices,
nodeTypesToShuffle = types.NodeTypeIt
}
- //so, fo reach execution group:
+ //so, for each execution group:
for _, groupID := range executionGroupIDs {
// pick out a representative spec
representativeSpec := specs[executionGroups[groupID][0]]
@@ -72,22 +128,9 @@ func OrderSpecs(specs Specs, suiteConfig types.SuiteConfig) (GroupedSpecIndices,
if len(shufflableGroupingIDToGroupIDs[shufflableGroupingNode.ID]) == 1 {
// record the shuffleable group ID
shufflableGroupingIDs = append(shufflableGroupingIDs, shufflableGroupingNode.ID)
- // and record the sort key to use
- shufflableGroupingsIDToSortKeys[shufflableGroupingNode.ID] = shufflableGroupingNode.CodeLocation.String()
}
}
- // now we sort the shufflable groups by the sort key. We use the shufflable group nodes code location and break ties using its node id
- sort.SliceStable(shufflableGroupingIDs, func(i, j int) bool {
- keyA := shufflableGroupingsIDToSortKeys[shufflableGroupingIDs[i]]
- keyB := shufflableGroupingsIDToSortKeys[shufflableGroupingIDs[j]]
- if keyA == keyB {
- return shufflableGroupingIDs[i] < shufflableGroupingIDs[j]
- } else {
- return keyA < keyB
- }
- })
-
// now we permute the sorted shufflable grouping IDs and build the ordered Groups
orderedGroups := GroupedSpecIndices{}
permutation := r.Perm(len(shufflableGroupingIDs))
diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/client_server.go b/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/client_server.go
index b417bf5b..b3cd6429 100644
--- a/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/client_server.go
+++ b/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/client_server.go
@@ -42,6 +42,8 @@ type Client interface {
PostSuiteWillBegin(report types.Report) error
PostDidRun(report types.SpecReport) error
PostSuiteDidEnd(report types.Report) error
+ PostReportBeforeSuiteCompleted(state types.SpecState) error
+ BlockUntilReportBeforeSuiteCompleted() (types.SpecState, error)
PostSynchronizedBeforeSuiteCompleted(state types.SpecState, data []byte) error
BlockUntilSynchronizedBeforeSuiteData() (types.SpecState, []byte, error)
BlockUntilNonprimaryProcsHaveFinished() error
diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/http_client.go b/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/http_client.go
index ad9932f2..6547c7a6 100644
--- a/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/http_client.go
+++ b/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/http_client.go
@@ -98,6 +98,19 @@ func (client *httpClient) PostEmitProgressReport(report types.ProgressReport) er
return client.post("/progress-report", report)
}
+func (client *httpClient) PostReportBeforeSuiteCompleted(state types.SpecState) error {
+ return client.post("/report-before-suite-completed", state)
+}
+
+func (client *httpClient) BlockUntilReportBeforeSuiteCompleted() (types.SpecState, error) {
+ var state types.SpecState
+ err := client.poll("/report-before-suite-state", &state)
+ if err == ErrorGone {
+ return types.SpecStateFailed, nil
+ }
+ return state, err
+}
+
func (client *httpClient) PostSynchronizedBeforeSuiteCompleted(state types.SpecState, data []byte) error {
beforeSuiteState := BeforeSuiteState{
State: state,
diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/http_server.go b/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/http_server.go
index fa3ac682..d2c71ab1 100644
--- a/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/http_server.go
+++ b/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/http_server.go
@@ -26,7 +26,7 @@ type httpServer struct {
handler *ServerHandler
}
-//Create a new server, automatically selecting a port
+// Create a new server, automatically selecting a port
func newHttpServer(parallelTotal int, reporter reporters.Reporter) (*httpServer, error) {
listener, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
@@ -38,7 +38,7 @@ func newHttpServer(parallelTotal int, reporter reporters.Reporter) (*httpServer,
}, nil
}
-//Start the server. You don't need to `go s.Start()`, just `s.Start()`
+// Start the server. You don't need to `go s.Start()`, just `s.Start()`
func (server *httpServer) Start() {
httpServer := &http.Server{}
mux := http.NewServeMux()
@@ -52,6 +52,8 @@ func (server *httpServer) Start() {
mux.HandleFunc("/progress-report", server.emitProgressReport)
//synchronization endpoints
+ mux.HandleFunc("/report-before-suite-completed", server.handleReportBeforeSuiteCompleted)
+ mux.HandleFunc("/report-before-suite-state", server.handleReportBeforeSuiteState)
mux.HandleFunc("/before-suite-completed", server.handleBeforeSuiteCompleted)
mux.HandleFunc("/before-suite-state", server.handleBeforeSuiteState)
mux.HandleFunc("/have-nonprimary-procs-finished", server.handleHaveNonprimaryProcsFinished)
@@ -63,12 +65,12 @@ func (server *httpServer) Start() {
go httpServer.Serve(server.listener)
}
-//Stop the server
+// Stop the server
func (server *httpServer) Close() {
server.listener.Close()
}
-//The address the server can be reached it. Pass this into the `ForwardingReporter`.
+// The address the server can be reached it. Pass this into the `ForwardingReporter`.
func (server *httpServer) Address() string {
return "http://" + server.listener.Addr().String()
}
@@ -93,7 +95,7 @@ func (server *httpServer) RegisterAlive(node int, alive func() bool) {
// Streaming Endpoints
//
-//The server will forward all received messages to Ginkgo reporters registered with `RegisterReporters`
+// The server will forward all received messages to Ginkgo reporters registered with `RegisterReporters`
func (server *httpServer) decode(writer http.ResponseWriter, request *http.Request, object interface{}) bool {
defer request.Body.Close()
if json.NewDecoder(request.Body).Decode(object) != nil {
@@ -164,6 +166,23 @@ func (server *httpServer) emitProgressReport(writer http.ResponseWriter, request
server.handleError(server.handler.EmitProgressReport(report, voidReceiver), writer)
}
+func (server *httpServer) handleReportBeforeSuiteCompleted(writer http.ResponseWriter, request *http.Request) {
+ var state types.SpecState
+ if !server.decode(writer, request, &state) {
+ return
+ }
+
+ server.handleError(server.handler.ReportBeforeSuiteCompleted(state, voidReceiver), writer)
+}
+
+func (server *httpServer) handleReportBeforeSuiteState(writer http.ResponseWriter, request *http.Request) {
+ var state types.SpecState
+ if server.handleError(server.handler.ReportBeforeSuiteState(voidSender, &state), writer) {
+ return
+ }
+ json.NewEncoder(writer).Encode(state)
+}
+
func (server *httpServer) handleBeforeSuiteCompleted(writer http.ResponseWriter, request *http.Request) {
var beforeSuiteState BeforeSuiteState
if !server.decode(writer, request, &beforeSuiteState) {
diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/rpc_client.go b/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/rpc_client.go
index fe93cc2b..59e8e6fd 100644
--- a/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/rpc_client.go
+++ b/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/rpc_client.go
@@ -76,6 +76,19 @@ func (client *rpcClient) PostEmitProgressReport(report types.ProgressReport) err
return client.client.Call("Server.EmitProgressReport", report, voidReceiver)
}
+func (client *rpcClient) PostReportBeforeSuiteCompleted(state types.SpecState) error {
+ return client.client.Call("Server.ReportBeforeSuiteCompleted", state, voidReceiver)
+}
+
+func (client *rpcClient) BlockUntilReportBeforeSuiteCompleted() (types.SpecState, error) {
+ var state types.SpecState
+ err := client.poll("Server.ReportBeforeSuiteState", &state)
+ if err == ErrorGone {
+ return types.SpecStateFailed, nil
+ }
+ return state, err
+}
+
func (client *rpcClient) PostSynchronizedBeforeSuiteCompleted(state types.SpecState, data []byte) error {
beforeSuiteState := BeforeSuiteState{
State: state,
diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/server_handler.go b/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/server_handler.go
index 7c6e67b9..a6d98793 100644
--- a/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/server_handler.go
+++ b/vendor/github.com/onsi/ginkgo/v2/internal/parallel_support/server_handler.go
@@ -18,16 +18,17 @@ var voidSender Void
// It handles all the business logic to avoid duplication between the two servers
type ServerHandler struct {
- done chan interface{}
- outputDestination io.Writer
- reporter reporters.Reporter
- alives []func() bool
- lock *sync.Mutex
- beforeSuiteState BeforeSuiteState
- parallelTotal int
- counter int
- counterLock *sync.Mutex
- shouldAbort bool
+ done chan interface{}
+ outputDestination io.Writer
+ reporter reporters.Reporter
+ alives []func() bool
+ lock *sync.Mutex
+ beforeSuiteState BeforeSuiteState
+ reportBeforeSuiteState types.SpecState
+ parallelTotal int
+ counter int
+ counterLock *sync.Mutex
+ shouldAbort bool
numSuiteDidBegins int
numSuiteDidEnds int
@@ -37,11 +38,12 @@ type ServerHandler struct {
func newServerHandler(parallelTotal int, reporter reporters.Reporter) *ServerHandler {
return &ServerHandler{
- reporter: reporter,
- lock: &sync.Mutex{},
- counterLock: &sync.Mutex{},
- alives: make([]func() bool, parallelTotal),
- beforeSuiteState: BeforeSuiteState{Data: nil, State: types.SpecStateInvalid},
+ reporter: reporter,
+ lock: &sync.Mutex{},
+ counterLock: &sync.Mutex{},
+ alives: make([]func() bool, parallelTotal),
+ beforeSuiteState: BeforeSuiteState{Data: nil, State: types.SpecStateInvalid},
+
parallelTotal: parallelTotal,
outputDestination: os.Stdout,
done: make(chan interface{}),
@@ -140,6 +142,29 @@ func (handler *ServerHandler) haveNonprimaryProcsFinished() bool {
return true
}
+func (handler *ServerHandler) ReportBeforeSuiteCompleted(reportBeforeSuiteState types.SpecState, _ *Void) error {
+ handler.lock.Lock()
+ defer handler.lock.Unlock()
+ handler.reportBeforeSuiteState = reportBeforeSuiteState
+
+ return nil
+}
+
+func (handler *ServerHandler) ReportBeforeSuiteState(_ Void, reportBeforeSuiteState *types.SpecState) error {
+ proc1IsAlive := handler.procIsAlive(1)
+ handler.lock.Lock()
+ defer handler.lock.Unlock()
+ if handler.reportBeforeSuiteState == types.SpecStateInvalid {
+ if proc1IsAlive {
+ return ErrorEarly
+ } else {
+ return ErrorGone
+ }
+ }
+ *reportBeforeSuiteState = handler.reportBeforeSuiteState
+ return nil
+}
+
func (handler *ServerHandler) BeforeSuiteCompleted(beforeSuiteState BeforeSuiteState, _ *Void) error {
handler.lock.Lock()
defer handler.lock.Unlock()
diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/suite.go b/vendor/github.com/onsi/ginkgo/v2/internal/suite.go
index d3671ebc..5ddf1007 100644
--- a/vendor/github.com/onsi/ginkgo/v2/internal/suite.go
+++ b/vendor/github.com/onsi/ginkgo/v2/internal/suite.go
@@ -129,7 +129,7 @@ func (suite *Suite) PushNode(node Node) error {
return suite.pushCleanupNode(node)
}
- if node.NodeType.Is(types.NodeTypeBeforeSuite | types.NodeTypeAfterSuite | types.NodeTypeSynchronizedBeforeSuite | types.NodeTypeSynchronizedAfterSuite | types.NodeTypeReportAfterSuite) {
+ if node.NodeType.Is(types.NodeTypeBeforeSuite | types.NodeTypeAfterSuite | types.NodeTypeSynchronizedBeforeSuite | types.NodeTypeSynchronizedAfterSuite | types.NodeTypeBeforeSuite | types.NodeTypeReportBeforeSuite | types.NodeTypeReportAfterSuite) {
return suite.pushSuiteNode(node)
}
@@ -151,6 +151,13 @@ func (suite *Suite) PushNode(node Node) error {
}
}
+ if node.MarkedContinueOnFailure {
+ firstOrderedNode := suite.tree.AncestorNodeChain().FirstNodeMarkedOrdered()
+ if !firstOrderedNode.IsZero() {
+ return types.GinkgoErrors.InvalidContinueOnFailureDecoration(node.CodeLocation)
+ }
+ }
+
if node.NodeType == types.NodeTypeContainer {
// During PhaseBuildTopLevel we only track the top level containers without entering them
// We only enter the top level container nodes during PhaseBuildTree
@@ -222,7 +229,7 @@ func (suite *Suite) pushCleanupNode(node Node) error {
node.NodeType = types.NodeTypeCleanupAfterSuite
case types.NodeTypeBeforeAll, types.NodeTypeAfterAll:
node.NodeType = types.NodeTypeCleanupAfterAll
- case types.NodeTypeReportBeforeEach, types.NodeTypeReportAfterEach, types.NodeTypeReportAfterSuite:
+ case types.NodeTypeReportBeforeEach, types.NodeTypeReportAfterEach, types.NodeTypeReportBeforeSuite, types.NodeTypeReportAfterSuite:
return types.GinkgoErrors.PushingCleanupInReportingNode(node.CodeLocation, suite.currentNode.NodeType)
case types.NodeTypeCleanupInvalid, types.NodeTypeCleanupAfterEach, types.NodeTypeCleanupAfterAll, types.NodeTypeCleanupAfterSuite:
return types.GinkgoErrors.PushingCleanupInCleanupNode(node.CodeLocation)
@@ -408,7 +415,13 @@ func (suite *Suite) runSpecs(description string, suiteLabels Labels, suitePath s
}
suite.report.SuiteSucceeded = true
- suite.runBeforeSuite(numSpecsThatWillBeRun)
+
+ suite.runReportSuiteNodesIfNeedBe(types.NodeTypeReportBeforeSuite)
+
+ ranBeforeSuite := suite.report.SuiteSucceeded
+ if suite.report.SuiteSucceeded {
+ suite.runBeforeSuite(numSpecsThatWillBeRun)
+ }
if suite.report.SuiteSucceeded {
groupedSpecIndices, serialGroupedSpecIndices := OrderSpecs(specs, suite.config)
@@ -447,7 +460,9 @@ func (suite *Suite) runSpecs(description string, suiteLabels Labels, suitePath s
}
}
- suite.runAfterSuiteCleanup(numSpecsThatWillBeRun)
+ if ranBeforeSuite {
+ suite.runAfterSuiteCleanup(numSpecsThatWillBeRun)
+ }
interruptStatus := suite.interruptHandler.Status()
if interruptStatus.Interrupted() {
@@ -461,9 +476,7 @@ func (suite *Suite) runSpecs(description string, suiteLabels Labels, suitePath s
suite.report.SuiteSucceeded = false
}
- if suite.config.ParallelProcess == 1 {
- suite.runReportAfterSuite()
- }
+ suite.runReportSuiteNodesIfNeedBe(types.NodeTypeReportAfterSuite)
suite.reporter.SuiteDidEnd(suite.report)
if suite.isRunningInParallel() {
suite.client.PostSuiteDidEnd(suite.report)
@@ -530,24 +543,6 @@ func (suite *Suite) runAfterSuiteCleanup(numSpecsThatWillBeRun int) {
}
}
-func (suite *Suite) runReportAfterSuite() {
- for _, node := range suite.suiteNodes.WithType(types.NodeTypeReportAfterSuite) {
- suite.selectiveLock.Lock()
- suite.currentSpecReport = types.SpecReport{
- LeafNodeType: node.NodeType,
- LeafNodeLocation: node.CodeLocation,
- LeafNodeText: node.Text,
- ParallelProcess: suite.config.ParallelProcess,
- RunningInParallel: suite.isRunningInParallel(),
- }
- suite.selectiveLock.Unlock()
-
- suite.reporter.WillRun(suite.currentSpecReport)
- suite.runReportAfterSuiteNode(node, suite.report)
- suite.processCurrentSpecReport()
- }
-}
-
func (suite *Suite) reportEach(spec Spec, nodeType types.NodeType) {
nodes := spec.Nodes.WithType(nodeType)
if nodeType == types.NodeTypeReportAfterEach {
@@ -672,16 +667,57 @@ func (suite *Suite) runSuiteNode(node Node) {
suite.currentSpecReport.RunTime = suite.currentSpecReport.EndTime.Sub(suite.currentSpecReport.StartTime)
suite.currentSpecReport.CapturedGinkgoWriterOutput = string(suite.writer.Bytes())
suite.currentSpecReport.CapturedStdOutErr += suite.outputInterceptor.StopInterceptingAndReturnOutput()
+}
- return
+func (suite *Suite) runReportSuiteNodesIfNeedBe(nodeType types.NodeType) {
+ nodes := suite.suiteNodes.WithType(nodeType)
+ // only run ReportAfterSuite on proc 1
+ if nodeType.Is(types.NodeTypeReportAfterSuite) && suite.config.ParallelProcess != 1 {
+ return
+ }
+ // if we're running ReportBeforeSuite on proc > 1 - we should wait until proc 1 has completed
+ if nodeType.Is(types.NodeTypeReportBeforeSuite) && suite.config.ParallelProcess != 1 && len(nodes) > 0 {
+ state, err := suite.client.BlockUntilReportBeforeSuiteCompleted()
+ if err != nil || state.Is(types.SpecStateFailed) {
+ suite.report.SuiteSucceeded = false
+ }
+ return
+ }
+
+ for _, node := range nodes {
+ suite.selectiveLock.Lock()
+ suite.currentSpecReport = types.SpecReport{
+ LeafNodeType: node.NodeType,
+ LeafNodeLocation: node.CodeLocation,
+ LeafNodeText: node.Text,
+ ParallelProcess: suite.config.ParallelProcess,
+ RunningInParallel: suite.isRunningInParallel(),
+ }
+ suite.selectiveLock.Unlock()
+
+ suite.reporter.WillRun(suite.currentSpecReport)
+ suite.runReportSuiteNode(node, suite.report)
+ suite.processCurrentSpecReport()
+ }
+
+ // if we're running ReportBeforeSuite and we're running in parallel - we shuld tell the other procs that we're done
+ if nodeType.Is(types.NodeTypeReportBeforeSuite) && suite.isRunningInParallel() && len(nodes) > 0 {
+ if suite.report.SuiteSucceeded {
+ suite.client.PostReportBeforeSuiteCompleted(types.SpecStatePassed)
+ } else {
+ suite.client.PostReportBeforeSuiteCompleted(types.SpecStateFailed)
+ }
+ }
}
-func (suite *Suite) runReportAfterSuiteNode(node Node, report types.Report) {
+func (suite *Suite) runReportSuiteNode(node Node, report types.Report) {
suite.writer.Truncate()
suite.outputInterceptor.StartInterceptingOutput()
suite.currentSpecReport.StartTime = time.Now()
- if suite.config.ParallelTotal > 1 {
+ // if we're running a ReportAfterSuite in parallel (on proc 1) we (a) wait until other procs have exited and
+ // (b) always fetch the latest report as prior ReportAfterSuites will contribute to it
+ if node.NodeType.Is(types.NodeTypeReportAfterSuite) && suite.isRunningInParallel() {
aggregatedReport, err := suite.client.BlockUntilAggregatedNonprimaryProcsReport()
if err != nil {
suite.currentSpecReport.State, suite.currentSpecReport.Failure = types.SpecStateFailed, suite.failureForLeafNodeWithMessage(node, err.Error())
@@ -691,15 +727,13 @@ func (suite *Suite) runReportAfterSuiteNode(node Node, report types.Report) {
report = report.Add(aggregatedReport)
}
- node.Body = func(SpecContext) { node.ReportAfterSuiteBody(report) }
+ node.Body = func(SpecContext) { node.ReportSuiteBody(report) }
suite.currentSpecReport.State, suite.currentSpecReport.Failure = suite.runNode(node, time.Time{}, "")
suite.currentSpecReport.EndTime = time.Now()
suite.currentSpecReport.RunTime = suite.currentSpecReport.EndTime.Sub(suite.currentSpecReport.StartTime)
suite.currentSpecReport.CapturedGinkgoWriterOutput = string(suite.writer.Bytes())
suite.currentSpecReport.CapturedStdOutErr = suite.outputInterceptor.StopInterceptingAndReturnOutput()
-
- return
}
func (suite *Suite) runNode(node Node, specDeadline time.Time, text string) (types.SpecState, types.Failure) {
diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/testingtproxy/testing_t_proxy.go b/vendor/github.com/onsi/ginkgo/v2/internal/testingtproxy/testing_t_proxy.go
index 2f42b264..c797c95d 100644
--- a/vendor/github.com/onsi/ginkgo/v2/internal/testingtproxy/testing_t_proxy.go
+++ b/vendor/github.com/onsi/ginkgo/v2/internal/testingtproxy/testing_t_proxy.go
@@ -81,7 +81,7 @@ func (t *ginkgoTestingTProxy) Fatalf(format string, args ...interface{}) {
}
func (t *ginkgoTestingTProxy) Helper() {
- // No-op
+ types.MarkAsHelper(1)
}
func (t *ginkgoTestingTProxy) Log(args ...interface{}) {
diff --git a/vendor/github.com/onsi/ginkgo/v2/reporters/default_reporter.go b/vendor/github.com/onsi/ginkgo/v2/reporters/default_reporter.go
index 7a27220c..56b7be75 100644
--- a/vendor/github.com/onsi/ginkgo/v2/reporters/default_reporter.go
+++ b/vendor/github.com/onsi/ginkgo/v2/reporters/default_reporter.go
@@ -12,6 +12,7 @@ import (
"io"
"runtime"
"strings"
+ "sync"
"time"
"github.com/onsi/ginkgo/v2/formatter"
@@ -23,7 +24,7 @@ type DefaultReporter struct {
writer io.Writer
// managing the emission stream
- lastChar string
+ lastCharWasNewline bool
lastEmissionWasDelimiter bool
// rendering
@@ -32,6 +33,7 @@ type DefaultReporter struct {
formatter formatter.Formatter
runningInParallel bool
+ lock *sync.Mutex
}
func NewDefaultReporterUnderTest(conf types.ReporterConfig, writer io.Writer) *DefaultReporter {
@@ -46,12 +48,13 @@ func NewDefaultReporter(conf types.ReporterConfig, writer io.Writer) *DefaultRep
conf: conf,
writer: writer,
- lastChar: "\n",
+ lastCharWasNewline: true,
lastEmissionWasDelimiter: false,
specDenoter: "•",
retryDenoter: "↺",
formatter: formatter.NewWithNoColorBool(conf.NoColor),
+ lock: &sync.Mutex{},
}
if runtime.GOOS == "windows" {
reporter.specDenoter = "+"
@@ -528,7 +531,7 @@ func (r *DefaultReporter) EmitReportEntry(entry types.ReportEntry) {
}
func (r *DefaultReporter) emitReportEntry(indent uint, entry types.ReportEntry) {
- r.emitBlock(r.fi(indent, "{{bold}}"+entry.Name+"{{gray}} - %s @ %s{{/}}", entry.Location, entry.Time.Format(types.GINKGO_TIME_FORMAT)))
+ r.emitBlock(r.fi(indent, "{{bold}}"+entry.Name+"{{gray}} "+fmt.Sprintf("- %s @ %s{{/}}", entry.Location, entry.Time.Format(types.GINKGO_TIME_FORMAT))))
if representation := entry.StringRepresentation(); representation != "" {
r.emitBlock(r.fi(indent+1, representation))
}
@@ -619,31 +622,37 @@ func (r *DefaultReporter) emitSource(indent uint, fc types.FunctionCall) {
/* Emitting to the writer */
func (r *DefaultReporter) emit(s string) {
- if len(s) > 0 {
- r.lastChar = s[len(s)-1:]
- r.lastEmissionWasDelimiter = false
- r.writer.Write([]byte(s))
- }
+ r._emit(s, false, false)
}
func (r *DefaultReporter) emitBlock(s string) {
- if len(s) > 0 {
- if r.lastChar != "\n" {
- r.emit("\n")
- }
- r.emit(s)
- if r.lastChar != "\n" {
- r.emit("\n")
- }
- }
+ r._emit(s, true, false)
}
func (r *DefaultReporter) emitDelimiter(indent uint) {
- if r.lastEmissionWasDelimiter {
+ r._emit(r.fi(indent, "{{gray}}%s{{/}}", strings.Repeat("-", 30)), true, true)
+}
+
+// a bit ugly - but we're trying to minimize locking on this hot codepath
+func (r *DefaultReporter) _emit(s string, block bool, isDelimiter bool) {
+ if len(s) == 0 {
+ return
+ }
+ r.lock.Lock()
+ defer r.lock.Unlock()
+ if isDelimiter && r.lastEmissionWasDelimiter {
return
}
- r.emitBlock(r.fi(indent, "{{gray}}%s{{/}}", strings.Repeat("-", 30)))
- r.lastEmissionWasDelimiter = true
+ if block && !r.lastCharWasNewline {
+ r.writer.Write([]byte("\n"))
+ }
+ r.lastCharWasNewline = (s[len(s)-1:] == "\n")
+ r.writer.Write([]byte(s))
+ if block && !r.lastCharWasNewline {
+ r.writer.Write([]byte("\n"))
+ r.lastCharWasNewline = true
+ }
+ r.lastEmissionWasDelimiter = isDelimiter
}
/* Rendering text */
diff --git a/vendor/github.com/onsi/ginkgo/v2/reporting_dsl.go b/vendor/github.com/onsi/ginkgo/v2/reporting_dsl.go
index afc151b1..f33786a2 100644
--- a/vendor/github.com/onsi/ginkgo/v2/reporting_dsl.go
+++ b/vendor/github.com/onsi/ginkgo/v2/reporting_dsl.go
@@ -35,7 +35,7 @@ func CurrentSpecReport() SpecReport {
}
/*
- ReportEntryVisibility governs the visibility of ReportEntries in Ginkgo's console reporter
+ ReportEntryVisibility governs the visibility of ReportEntries in Ginkgo's console reporter
- ReportEntryVisibilityAlways: the default behavior - the ReportEntry is always emitted.
- ReportEntryVisibilityFailureOrVerbose: the ReportEntry is only emitted if the spec fails or if the tests are run with -v (similar to GinkgoWriters behavior).
@@ -50,9 +50,9 @@ const ReportEntryVisibilityAlways, ReportEntryVisibilityFailureOrVerbose, Report
/*
AddReportEntry generates and adds a new ReportEntry to the current spec's SpecReport.
It can take any of the following arguments:
- - A single arbitrary object to attach as the Value of the ReportEntry. This object will be included in any generated reports and will be emitted to the console when the report is emitted.
- - A ReportEntryVisibility enum to control the visibility of the ReportEntry
- - An Offset or CodeLocation decoration to control the reported location of the ReportEntry
+ - A single arbitrary object to attach as the Value of the ReportEntry. This object will be included in any generated reports and will be emitted to the console when the report is emitted.
+ - A ReportEntryVisibility enum to control the visibility of the ReportEntry
+ - An Offset or CodeLocation decoration to control the reported location of the ReportEntry
If the Value object implements `fmt.Stringer`, it's `String()` representation is used when emitting to the console.
@@ -100,6 +100,25 @@ func ReportAfterEach(body func(SpecReport), args ...interface{}) bool {
return pushNode(internal.NewNode(deprecationTracker, types.NodeTypeReportAfterEach, "", combinedArgs...))
}
+/*
+ReportBeforeSuite nodes are run at the beginning of the suite. ReportBeforeSuite nodes take a function that receives a suite Report.
+
+They are called at the beginning of the suite, before any specs have run and any BeforeSuite or SynchronizedBeforeSuite nodes, and are passed in the initial report for the suite.
+ReportBeforeSuite nodes must be created at the top-level (i.e. not nested in a Context/Describe/When node)
+
+# When running in parallel, Ginkgo ensures that only one of the parallel nodes runs the ReportBeforeSuite
+
+You cannot nest any other Ginkgo nodes within a ReportAfterSuite node's closure.
+You can learn more about ReportAfterSuite here: https://onsi.github.io/ginkgo/#generating-reports-programmatically
+
+You can learn more about Ginkgo's reporting infrastructure, including generating reports with the CLI here: https://onsi.github.io/ginkgo/#generating-machine-readable-reports
+*/
+func ReportBeforeSuite(body func(Report), args ...interface{}) bool {
+ combinedArgs := []interface{}{body}
+ combinedArgs = append(combinedArgs, args...)
+ return pushNode(internal.NewNode(deprecationTracker, types.NodeTypeReportBeforeSuite, "", combinedArgs...))
+}
+
/*
ReportAfterSuite nodes are run at the end of the suite. ReportAfterSuite nodes take a function that receives a suite Report.
@@ -113,6 +132,7 @@ In addition to using ReportAfterSuite to programmatically generate suite reports
You cannot nest any other Ginkgo nodes within a ReportAfterSuite node's closure.
You can learn more about ReportAfterSuite here: https://onsi.github.io/ginkgo/#generating-reports-programmatically
+
You can learn more about Ginkgo's reporting infrastructure, including generating reports with the CLI here: https://onsi.github.io/ginkgo/#generating-machine-readable-reports
*/
func ReportAfterSuite(text string, body func(Report), args ...interface{}) bool {
diff --git a/vendor/github.com/onsi/ginkgo/v2/table_dsl.go b/vendor/github.com/onsi/ginkgo/v2/table_dsl.go
index 68367446..ac9b7abb 100644
--- a/vendor/github.com/onsi/ginkgo/v2/table_dsl.go
+++ b/vendor/github.com/onsi/ginkgo/v2/table_dsl.go
@@ -13,7 +13,7 @@ import (
/*
The EntryDescription decorator allows you to pass a format string to DescribeTable() and Entry(). This format string is used to generate entry names via:
- fmt.Sprintf(formatString, parameters...)
+ fmt.Sprintf(formatString, parameters...)
where parameters are the parameters passed into the entry.
@@ -32,19 +32,20 @@ DescribeTable describes a table-driven spec.
For example:
- DescribeTable("a simple table",
- func(x int, y int, expected bool) {
- Ω(x > y).Should(Equal(expected))
- },
- Entry("x > y", 1, 0, true),
- Entry("x == y", 0, 0, false),
- Entry("x < y", 0, 1, false),
- )
+ DescribeTable("a simple table",
+ func(x int, y int, expected bool) {
+ Ω(x > y).Should(Equal(expected))
+ },
+ Entry("x > y", 1, 0, true),
+ Entry("x == y", 0, 0, false),
+ Entry("x < y", 0, 1, false),
+ )
You can learn more about DescribeTable here: https://onsi.github.io/ginkgo/#table-specs
And can explore some Table patterns here: https://onsi.github.io/ginkgo/#table-specs-patterns
*/
func DescribeTable(description string, args ...interface{}) bool {
+ GinkgoHelper()
generateTable(description, args...)
return true
}
@@ -53,6 +54,7 @@ func DescribeTable(description string, args ...interface{}) bool {
You can focus a table with `FDescribeTable`. This is equivalent to `FDescribe`.
*/
func FDescribeTable(description string, args ...interface{}) bool {
+ GinkgoHelper()
args = append(args, internal.Focus)
generateTable(description, args...)
return true
@@ -62,6 +64,7 @@ func FDescribeTable(description string, args ...interface{}) bool {
You can mark a table as pending with `PDescribeTable`. This is equivalent to `PDescribe`.
*/
func PDescribeTable(description string, args ...interface{}) bool {
+ GinkgoHelper()
args = append(args, internal.Pending)
generateTable(description, args...)
return true
@@ -95,26 +98,29 @@ If you want to generate interruptible specs simply write a Table function that a
You can learn more about Entry here: https://onsi.github.io/ginkgo/#table-specs
*/
func Entry(description interface{}, args ...interface{}) TableEntry {
+ GinkgoHelper()
decorations, parameters := internal.PartitionDecorations(args...)
- return TableEntry{description: description, decorations: decorations, parameters: parameters, codeLocation: types.NewCodeLocation(1)}
+ return TableEntry{description: description, decorations: decorations, parameters: parameters, codeLocation: types.NewCodeLocation(0)}
}
/*
You can focus a particular entry with FEntry. This is equivalent to FIt.
*/
func FEntry(description interface{}, args ...interface{}) TableEntry {
+ GinkgoHelper()
decorations, parameters := internal.PartitionDecorations(args...)
decorations = append(decorations, internal.Focus)
- return TableEntry{description: description, decorations: decorations, parameters: parameters, codeLocation: types.NewCodeLocation(1)}
+ return TableEntry{description: description, decorations: decorations, parameters: parameters, codeLocation: types.NewCodeLocation(0)}
}
/*
You can mark a particular entry as pending with PEntry. This is equivalent to PIt.
*/
func PEntry(description interface{}, args ...interface{}) TableEntry {
+ GinkgoHelper()
decorations, parameters := internal.PartitionDecorations(args...)
decorations = append(decorations, internal.Pending)
- return TableEntry{description: description, decorations: decorations, parameters: parameters, codeLocation: types.NewCodeLocation(1)}
+ return TableEntry{description: description, decorations: decorations, parameters: parameters, codeLocation: types.NewCodeLocation(0)}
}
/*
@@ -126,7 +132,8 @@ var contextType = reflect.TypeOf(new(context.Context)).Elem()
var specContextType = reflect.TypeOf(new(SpecContext)).Elem()
func generateTable(description string, args ...interface{}) {
- cl := types.NewCodeLocation(2)
+ GinkgoHelper()
+ cl := types.NewCodeLocation(0)
containerNodeArgs := []interface{}{cl}
entries := []TableEntry{}
diff --git a/vendor/github.com/onsi/ginkgo/v2/tools.go b/vendor/github.com/onsi/ginkgo/v2/tools.go
new file mode 100644
index 00000000..97429446
--- /dev/null
+++ b/vendor/github.com/onsi/ginkgo/v2/tools.go
@@ -0,0 +1,8 @@
+//go:build tools
+// +build tools
+
+package ginkgo
+
+import (
+ _ "github.com/onsi/ginkgo/v2/ginkgo"
+)
diff --git a/vendor/github.com/onsi/ginkgo/v2/types/code_location.go b/vendor/github.com/onsi/ginkgo/v2/types/code_location.go
index 12910918..9cd57681 100644
--- a/vendor/github.com/onsi/ginkgo/v2/types/code_location.go
+++ b/vendor/github.com/onsi/ginkgo/v2/types/code_location.go
@@ -7,6 +7,7 @@ import (
"runtime"
"runtime/debug"
"strings"
+ "sync"
)
type CodeLocation struct {
@@ -38,6 +39,73 @@ func (codeLocation CodeLocation) ContentsOfLine() string {
return lines[codeLocation.LineNumber-1]
}
+type codeLocationLocator struct {
+ pcs map[uintptr]bool
+ helpers map[string]bool
+ lock *sync.Mutex
+}
+
+func (c *codeLocationLocator) addHelper(pc uintptr) {
+ c.lock.Lock()
+ defer c.lock.Unlock()
+
+ if c.pcs[pc] {
+ return
+ }
+ c.lock.Unlock()
+ f := runtime.FuncForPC(pc)
+ c.lock.Lock()
+ if f == nil {
+ return
+ }
+ c.helpers[f.Name()] = true
+ c.pcs[pc] = true
+}
+
+func (c *codeLocationLocator) hasHelper(name string) bool {
+ c.lock.Lock()
+ defer c.lock.Unlock()
+ return c.helpers[name]
+}
+
+func (c *codeLocationLocator) getCodeLocation(skip int) CodeLocation {
+ pc := make([]uintptr, 40)
+ n := runtime.Callers(skip+2, pc)
+ if n == 0 {
+ return CodeLocation{}
+ }
+ pc = pc[:n]
+ frames := runtime.CallersFrames(pc)
+ for {
+ frame, more := frames.Next()
+ if !c.hasHelper(frame.Function) {
+ return CodeLocation{FileName: frame.File, LineNumber: frame.Line}
+ }
+ if !more {
+ break
+ }
+ }
+ return CodeLocation{}
+}
+
+var clLocator = &codeLocationLocator{
+ pcs: map[uintptr]bool{},
+ helpers: map[string]bool{},
+ lock: &sync.Mutex{},
+}
+
+// MarkAsHelper is used by GinkgoHelper to mark the caller (appropriately offset by skip)as a helper. You can use this directly if you need to provide an optional `skip` to mark functions further up the call stack as helpers.
+func MarkAsHelper(optionalSkip ...int) {
+ skip := 1
+ if len(optionalSkip) > 0 {
+ skip += optionalSkip[0]
+ }
+ pc, _, _, ok := runtime.Caller(skip)
+ if ok {
+ clLocator.addHelper(pc)
+ }
+}
+
func NewCustomCodeLocation(message string) CodeLocation {
return CodeLocation{
CustomMessage: message,
@@ -45,14 +113,13 @@ func NewCustomCodeLocation(message string) CodeLocation {
}
func NewCodeLocation(skip int) CodeLocation {
- _, file, line, _ := runtime.Caller(skip + 1)
- return CodeLocation{FileName: file, LineNumber: line}
+ return clLocator.getCodeLocation(skip + 1)
}
func NewCodeLocationWithStackTrace(skip int) CodeLocation {
- _, file, line, _ := runtime.Caller(skip + 1)
- stackTrace := PruneStack(string(debug.Stack()), skip+1)
- return CodeLocation{FileName: file, LineNumber: line, FullStackTrace: stackTrace}
+ cl := clLocator.getCodeLocation(skip + 1)
+ cl.FullStackTrace = PruneStack(string(debug.Stack()), skip+1)
+ return cl
}
// PruneStack removes references to functions that are internal to Ginkgo
diff --git a/vendor/github.com/onsi/ginkgo/v2/types/config.go b/vendor/github.com/onsi/ginkgo/v2/types/config.go
index 4ec636eb..1efd77d3 100644
--- a/vendor/github.com/onsi/ginkgo/v2/types/config.go
+++ b/vendor/github.com/onsi/ginkgo/v2/types/config.go
@@ -30,6 +30,7 @@ type SuiteConfig struct {
PollProgressAfter time.Duration
PollProgressInterval time.Duration
Timeout time.Duration
+ EmitSpecProgress bool // this is deprecated but its removal is causing compile issue for some users that were setting it manually
OutputInterceptorMode string
SourceRoots []string
GracePeriod time.Duration
diff --git a/vendor/github.com/onsi/ginkgo/v2/types/errors.go b/vendor/github.com/onsi/ginkgo/v2/types/errors.go
index b7ed5a21..1e0dbfd9 100644
--- a/vendor/github.com/onsi/ginkgo/v2/types/errors.go
+++ b/vendor/github.com/onsi/ginkgo/v2/types/errors.go
@@ -108,8 +108,8 @@ Please ensure all assertions are inside leaf nodes such as {{bold}}BeforeEach{{/
func (g ginkgoErrors) SuiteNodeInNestedContext(nodeType NodeType, cl CodeLocation) error {
docLink := "suite-setup-and-cleanup-beforesuite-and-aftersuite"
- if nodeType.Is(NodeTypeReportAfterSuite) {
- docLink = "reporting-nodes---reportaftersuite"
+ if nodeType.Is(NodeTypeReportBeforeSuite | NodeTypeReportAfterSuite) {
+ docLink = "reporting-nodes---reportbeforesuite-and-reportaftersuite"
}
return GinkgoError{
@@ -125,8 +125,8 @@ func (g ginkgoErrors) SuiteNodeInNestedContext(nodeType NodeType, cl CodeLocatio
func (g ginkgoErrors) SuiteNodeDuringRunPhase(nodeType NodeType, cl CodeLocation) error {
docLink := "suite-setup-and-cleanup-beforesuite-and-aftersuite"
- if nodeType.Is(NodeTypeReportAfterSuite) {
- docLink = "reporting-nodes---reportaftersuite"
+ if nodeType.Is(NodeTypeReportBeforeSuite | NodeTypeReportAfterSuite) {
+ docLink = "reporting-nodes---reportbeforesuite-and-reportaftersuite"
}
return GinkgoError{
@@ -298,6 +298,15 @@ func (g ginkgoErrors) SetupNodeNotInOrderedContainer(cl CodeLocation, nodeType N
}
}
+func (g ginkgoErrors) InvalidContinueOnFailureDecoration(cl CodeLocation) error {
+ return GinkgoError{
+ Heading: "ContinueOnFailure not decorating an outermost Ordered Container",
+ Message: "ContinueOnFailure can only decorate an Ordered container, and this Ordered container must be the outermost Ordered container.",
+ CodeLocation: cl,
+ DocLink: "ordered-containers",
+ }
+}
+
/* DeferCleanup errors */
func (g ginkgoErrors) DeferCleanupInvalidFunction(cl CodeLocation) error {
return GinkgoError{
@@ -320,7 +329,7 @@ func (g ginkgoErrors) PushingCleanupNodeDuringTreeConstruction(cl CodeLocation)
func (g ginkgoErrors) PushingCleanupInReportingNode(cl CodeLocation, nodeType NodeType) error {
return GinkgoError{
Heading: fmt.Sprintf("DeferCleanup cannot be called in %s", nodeType),
- Message: "Please inline your cleanup code - Ginkgo won't run cleanup code after a ReportAfterEach or ReportAfterSuite.",
+ Message: "Please inline your cleanup code - Ginkgo won't run cleanup code after a Reporting node.",
CodeLocation: cl,
DocLink: "cleaning-up-our-cleanup-code-defercleanup",
}
diff --git a/vendor/github.com/onsi/ginkgo/v2/types/label_filter.go b/vendor/github.com/onsi/ginkgo/v2/types/label_filter.go
index 0403f9e6..b0d3b651 100644
--- a/vendor/github.com/onsi/ginkgo/v2/types/label_filter.go
+++ b/vendor/github.com/onsi/ginkgo/v2/types/label_filter.go
@@ -272,12 +272,23 @@ func tokenize(input string) func() (*treeNode, error) {
}
}
+func MustParseLabelFilter(input string) LabelFilter {
+ filter, err := ParseLabelFilter(input)
+ if err != nil {
+ panic(err)
+ }
+ return filter
+}
+
func ParseLabelFilter(input string) (LabelFilter, error) {
if DEBUG_LABEL_FILTER_PARSING {
fmt.Println("\n==============")
fmt.Println("Input: ", input)
fmt.Print("Tokens: ")
}
+ if input == "" {
+ return func(_ []string) bool { return true }, nil
+ }
nextToken := tokenize(input)
root := &treeNode{token: lfTokenRoot}
diff --git a/vendor/github.com/onsi/ginkgo/v2/types/types.go b/vendor/github.com/onsi/ginkgo/v2/types/types.go
index a388f70c..d048a8ad 100644
--- a/vendor/github.com/onsi/ginkgo/v2/types/types.go
+++ b/vendor/github.com/onsi/ginkgo/v2/types/types.go
@@ -58,6 +58,7 @@ type Report struct {
SuiteConfig SuiteConfig
//SpecReports is a list of all SpecReports generated by this test run
+ //It is empty when the SuiteReport is provided to ReportBeforeSuite
SpecReports SpecReports
}
@@ -603,6 +604,9 @@ var ssEnumSupport = NewEnumSupport(map[uint]string{
func (ss SpecState) String() string {
return ssEnumSupport.String(uint(ss))
}
+func (ss SpecState) GomegaString() string {
+ return ssEnumSupport.String(uint(ss))
+}
func (ss *SpecState) UnmarshalJSON(b []byte) error {
out, err := ssEnumSupport.UnmarshJSON(b)
*ss = SpecState(out)
@@ -761,6 +765,7 @@ const (
NodeTypeReportBeforeEach
NodeTypeReportAfterEach
+ NodeTypeReportBeforeSuite
NodeTypeReportAfterSuite
NodeTypeCleanupInvalid
@@ -770,9 +775,9 @@ const (
)
var NodeTypesForContainerAndIt = NodeTypeContainer | NodeTypeIt
-var NodeTypesForSuiteLevelNodes = NodeTypeBeforeSuite | NodeTypeSynchronizedBeforeSuite | NodeTypeAfterSuite | NodeTypeSynchronizedAfterSuite | NodeTypeReportAfterSuite | NodeTypeCleanupAfterSuite
+var NodeTypesForSuiteLevelNodes = NodeTypeBeforeSuite | NodeTypeSynchronizedBeforeSuite | NodeTypeAfterSuite | NodeTypeSynchronizedAfterSuite | NodeTypeReportBeforeSuite | NodeTypeReportAfterSuite | NodeTypeCleanupAfterSuite
var NodeTypesAllowedDuringCleanupInterrupt = NodeTypeAfterEach | NodeTypeJustAfterEach | NodeTypeAfterAll | NodeTypeAfterSuite | NodeTypeSynchronizedAfterSuite | NodeTypeCleanupAfterEach | NodeTypeCleanupAfterAll | NodeTypeCleanupAfterSuite
-var NodeTypesAllowedDuringReportInterrupt = NodeTypeReportBeforeEach | NodeTypeReportAfterEach | NodeTypeReportAfterSuite
+var NodeTypesAllowedDuringReportInterrupt = NodeTypeReportBeforeEach | NodeTypeReportAfterEach | NodeTypeReportBeforeSuite | NodeTypeReportAfterSuite
var ntEnumSupport = NewEnumSupport(map[uint]string{
uint(NodeTypeInvalid): "INVALID NODE TYPE",
@@ -790,6 +795,7 @@ var ntEnumSupport = NewEnumSupport(map[uint]string{
uint(NodeTypeSynchronizedAfterSuite): "SynchronizedAfterSuite",
uint(NodeTypeReportBeforeEach): "ReportBeforeEach",
uint(NodeTypeReportAfterEach): "ReportAfterEach",
+ uint(NodeTypeReportBeforeSuite): "ReportBeforeSuite",
uint(NodeTypeReportAfterSuite): "ReportAfterSuite",
uint(NodeTypeCleanupInvalid): "DeferCleanup",
uint(NodeTypeCleanupAfterEach): "DeferCleanup (Each)",
diff --git a/vendor/github.com/onsi/ginkgo/v2/types/version.go b/vendor/github.com/onsi/ginkgo/v2/types/version.go
index 7745c9a7..185317c6 100644
--- a/vendor/github.com/onsi/ginkgo/v2/types/version.go
+++ b/vendor/github.com/onsi/ginkgo/v2/types/version.go
@@ -1,3 +1,3 @@
package types
-const VERSION = "2.5.1"
+const VERSION = "2.8.3"
diff --git a/vendor/github.com/onsi/gomega/.gitignore b/vendor/github.com/onsi/gomega/.gitignore
index 5f12ff05..52266eae 100644
--- a/vendor/github.com/onsi/gomega/.gitignore
+++ b/vendor/github.com/onsi/gomega/.gitignore
@@ -3,4 +3,5 @@
.
.idea
gomega.iml
-TODO.md
\ No newline at end of file
+TODO.md
+.vscode
\ No newline at end of file
diff --git a/vendor/github.com/onsi/gomega/CHANGELOG.md b/vendor/github.com/onsi/gomega/CHANGELOG.md
index 5ebd74a5..99ea9407 100644
--- a/vendor/github.com/onsi/gomega/CHANGELOG.md
+++ b/vendor/github.com/onsi/gomega/CHANGELOG.md
@@ -1,3 +1,59 @@
+## 1.27.1
+
+### Maintenance
+
+- Bump golang.org/x/net from 0.6.0 to 0.7.0 (#640) [bc686cd]
+
+## 1.27.0
+
+### Features
+- Add HaveExactElements matcher (#634) [9d50783]
+- update Gomega docs to discuss GinkgoHelper() [be32774]
+
+### Maintenance
+- Bump github.com/onsi/ginkgo/v2 from 2.8.0 to 2.8.1 (#639) [296a68b]
+- Bump golang.org/x/net from 0.5.0 to 0.6.0 (#638) [c2b098b]
+- Bump github-pages from 227 to 228 in /docs (#636) [a9069ab]
+- test: update matrix for Go 1.20 (#635) [6bd25c8]
+- Bump github.com/onsi/ginkgo/v2 from 2.7.0 to 2.8.0 (#631) [5445f8b]
+- Bump webrick from 1.7.0 to 1.8.1 in /docs (#630) [03e93bb]
+- codeql: add ruby language (#626) [63c7d21]
+- dependabot: add bundler package-ecosystem for docs (#625) [d92f963]
+
+## 1.26.0
+
+### Features
+- When a polled function returns an error, keep track of the actual and report on the matcher state of the last non-errored actual [21f3090]
+- improve eventually failure message output [c530fb3]
+
+### Fixes
+- fix several documentation spelling issues [e2eff1f]
+
+
+## 1.25.0
+
+### Features
+- add `MustPassRepeatedly(int)` to asyncAssertion (#619) [4509f72]
+- compare unwrapped errors using DeepEqual (#617) [aaeaa5d]
+
+### Maintenance
+- Bump golang.org/x/net from 0.4.0 to 0.5.0 (#614) [c7cfea4]
+- Bump github.com/onsi/ginkgo/v2 from 2.6.1 to 2.7.0 (#615) [71b8adb]
+- Docs: Fix typo "MUltiple" -> "Multiple" (#616) [9351dda]
+- clean up go.sum [cd1dc1d]
+
+## 1.24.2
+
+### Fixes
+- Correctly handle assertion failure panics for eventually/consistnetly "g Gomega"s in a goroutine [78f1660]
+- docs:Fix typo "you an" -> "you can" (#607) [3187c1f]
+- fixes issue #600 (#606) [808d192]
+
+### Maintenance
+- Bump golang.org/x/net from 0.2.0 to 0.4.0 (#611) [6ebc0bf]
+- Bump nokogiri from 1.13.9 to 1.13.10 in /docs (#612) [258cfc8]
+- Bump github.com/onsi/ginkgo/v2 from 2.5.0 to 2.5.1 (#609) [e6c3eb9]
+
## 1.24.1
### Fixes
diff --git a/vendor/github.com/onsi/gomega/gomega_dsl.go b/vendor/github.com/onsi/gomega/gomega_dsl.go
index d00383e1..4405c068 100644
--- a/vendor/github.com/onsi/gomega/gomega_dsl.go
+++ b/vendor/github.com/onsi/gomega/gomega_dsl.go
@@ -22,7 +22,7 @@ import (
"github.com/onsi/gomega/types"
)
-const GOMEGA_VERSION = "1.24.1"
+const GOMEGA_VERSION = "1.27.1"
const nilGomegaPanic = `You are trying to make an assertion, but haven't registered Gomega's fail handler.
If you're using Ginkgo then you probably forgot to put your assertion in an It().
@@ -360,6 +360,16 @@ You can also pass additional arugments to functions that take a Gomega. The onl
g.Expect(elements).To(ConsistOf(expected))
}).WithContext(ctx).WithArguments("/names", "Joe", "Jane", "Sam").Should(Succeed())
+You can ensure that you get a number of consecutive successful tries before succeeding using `MustPassRepeatedly(int)`. For Example:
+
+ int count := 0
+ Eventually(func() bool {
+ count++
+ return count > 2
+ }).MustPassRepeatedly(2).Should(BeTrue())
+ // Because we had to wait for 2 calls that returned true
+ Expect(count).To(Equal(3))
+
Finally, in addition to passing timeouts and a context to Eventually you can be more explicit with Eventually's chaining configuration methods:
Eventually(..., "1s", "2s", ctx).Should(...)
diff --git a/vendor/github.com/onsi/gomega/internal/async_assertion.go b/vendor/github.com/onsi/gomega/internal/async_assertion.go
index c1e4a999..7f622696 100644
--- a/vendor/github.com/onsi/gomega/internal/async_assertion.go
+++ b/vendor/github.com/onsi/gomega/internal/async_assertion.go
@@ -2,6 +2,7 @@ package internal
import (
"context"
+ "errors"
"fmt"
"reflect"
"runtime"
@@ -16,10 +17,37 @@ var errInterface = reflect.TypeOf((*error)(nil)).Elem()
var gomegaType = reflect.TypeOf((*types.Gomega)(nil)).Elem()
var contextType = reflect.TypeOf(new(context.Context)).Elem()
+type formattedGomegaError interface {
+ FormattedGomegaError() string
+}
+
+type asyncPolledActualError struct {
+ message string
+}
+
+func (err *asyncPolledActualError) Error() string {
+ return err.message
+}
+
+func (err *asyncPolledActualError) FormattedGomegaError() string {
+ return err.message
+}
+
type contextWithAttachProgressReporter interface {
AttachProgressReporter(func() string) func()
}
+type asyncGomegaHaltExecutionError struct{}
+
+func (a asyncGomegaHaltExecutionError) GinkgoRecoverShouldIgnoreThisPanic() {}
+func (a asyncGomegaHaltExecutionError) Error() string {
+ return `An assertion has failed in a goroutine. You should call
+
+ defer GinkgoRecover()
+
+at the top of the goroutine that caused this panic. This will allow Ginkgo and Gomega to correctly capture and manage this panic.`
+}
+
type AsyncAssertionType uint
const (
@@ -44,21 +72,23 @@ type AsyncAssertion struct {
actual interface{}
argsToForward []interface{}
- timeoutInterval time.Duration
- pollingInterval time.Duration
- ctx context.Context
- offset int
- g *Gomega
+ timeoutInterval time.Duration
+ pollingInterval time.Duration
+ mustPassRepeatedly int
+ ctx context.Context
+ offset int
+ g *Gomega
}
-func NewAsyncAssertion(asyncType AsyncAssertionType, actualInput interface{}, g *Gomega, timeoutInterval time.Duration, pollingInterval time.Duration, ctx context.Context, offset int) *AsyncAssertion {
+func NewAsyncAssertion(asyncType AsyncAssertionType, actualInput interface{}, g *Gomega, timeoutInterval time.Duration, pollingInterval time.Duration, mustPassRepeatedly int, ctx context.Context, offset int) *AsyncAssertion {
out := &AsyncAssertion{
- asyncType: asyncType,
- timeoutInterval: timeoutInterval,
- pollingInterval: pollingInterval,
- offset: offset,
- ctx: ctx,
- g: g,
+ asyncType: asyncType,
+ timeoutInterval: timeoutInterval,
+ pollingInterval: pollingInterval,
+ mustPassRepeatedly: mustPassRepeatedly,
+ offset: offset,
+ ctx: ctx,
+ g: g,
}
out.actual = actualInput
@@ -104,6 +134,11 @@ func (assertion *AsyncAssertion) WithArguments(argsToForward ...interface{}) typ
return assertion
}
+func (assertion *AsyncAssertion) MustPassRepeatedly(count int) types.AsyncAssertion {
+ assertion.mustPassRepeatedly = count
+ return assertion
+}
+
func (assertion *AsyncAssertion) Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool {
assertion.g.THelper()
vetOptionalDescription("Asynchronous assertion", optionalDescription...)
@@ -130,7 +165,9 @@ func (assertion *AsyncAssertion) buildDescription(optionalDescription ...interfa
func (assertion *AsyncAssertion) processReturnValues(values []reflect.Value) (interface{}, error) {
if len(values) == 0 {
- return nil, fmt.Errorf("No values were returned by the function passed to Gomega")
+ return nil, &asyncPolledActualError{
+ message: fmt.Sprintf("The function passed to %s did not return any values", assertion.asyncType),
+ }
}
actual := values[0].Interface()
@@ -153,10 +190,12 @@ func (assertion *AsyncAssertion) processReturnValues(values []reflect.Value) (in
continue
}
if i == len(values)-2 && extraType.Implements(errInterface) {
- err = fmt.Errorf("function returned error: %w", extra.(error))
+ err = extra.(error)
}
if err == nil {
- err = fmt.Errorf("Unexpected non-nil/non-zero return value at index %d:\n\t<%T>: %#v", i+1, extra, extra)
+ err = &asyncPolledActualError{
+ message: fmt.Sprintf("The function passed to %s had an unexpected non-nil/non-zero return value at index %d:\n%s", assertion.asyncType, i+1, format.Object(extra, 1)),
+ }
}
}
@@ -191,6 +230,13 @@ You can learn more at https://onsi.github.io/gomega/#eventually
`, assertion.asyncType, t, t.NumIn(), numProvided, have, assertion.asyncType)
}
+func (assertion *AsyncAssertion) invalidMustPassRepeatedlyError(reason string) error {
+ return fmt.Errorf(`Invalid use of MustPassRepeatedly with %s %s
+
+You can learn more at https://onsi.github.io/gomega/#eventually
+`, assertion.asyncType, reason)
+}
+
func (assertion *AsyncAssertion) buildActualPoller() (func() (interface{}, error), error) {
if !assertion.actualIsFunc {
return func() (interface{}, error) { return assertion.actual, nil }, nil
@@ -228,8 +274,11 @@ func (assertion *AsyncAssertion) buildActualPoller() (func() (interface{}, error
skip = callerSkip[0]
}
_, file, line, _ := runtime.Caller(skip + 1)
- assertionFailure = fmt.Errorf("Assertion in callback at %s:%d failed:\n%s", file, line, message)
- panic("stop execution")
+ assertionFailure = &asyncPolledActualError{
+ message: fmt.Sprintf("The function passed to %s failed at %s:%d with:\n%s", assertion.asyncType, file, line, message),
+ }
+ // we throw an asyncGomegaHaltExecutionError so that defer GinkgoRecover() can catch this error if the user makes an assertion in a goroutine
+ panic(asyncGomegaHaltExecutionError{})
})))
}
if takesContext {
@@ -245,6 +294,13 @@ func (assertion *AsyncAssertion) buildActualPoller() (func() (interface{}, error
return nil, assertion.argumentMismatchError(actualType, len(inValues))
}
+ if assertion.mustPassRepeatedly != 1 && assertion.asyncType != AsyncAssertionTypeEventually {
+ return nil, assertion.invalidMustPassRepeatedlyError("it can only be used with Eventually")
+ }
+ if assertion.mustPassRepeatedly < 1 {
+ return nil, assertion.invalidMustPassRepeatedlyError("parameter can't be < 1")
+ }
+
return func() (actual interface{}, err error) {
var values []reflect.Value
assertionFailure = nil
@@ -326,22 +382,39 @@ func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch
timeout := assertion.afterTimeout()
lock := sync.Mutex{}
- var matches bool
- var err error
+ var matches, hasLastValidActual bool
+ var actual, lastValidActual interface{}
+ var actualErr, matcherErr error
var oracleMatcherSaysStop bool
assertion.g.THelper()
- pollActual, err := assertion.buildActualPoller()
- if err != nil {
- assertion.g.Fail(err.Error(), 2+assertion.offset)
+ pollActual, buildActualPollerErr := assertion.buildActualPoller()
+ if buildActualPollerErr != nil {
+ assertion.g.Fail(buildActualPollerErr.Error(), 2+assertion.offset)
return false
}
- value, err := pollActual()
- if err == nil {
- oracleMatcherSaysStop = assertion.matcherSaysStopTrying(matcher, value)
- matches, err = assertion.pollMatcher(matcher, value)
+ actual, actualErr = pollActual()
+ if actualErr == nil {
+ lastValidActual = actual
+ hasLastValidActual = true
+ oracleMatcherSaysStop = assertion.matcherSaysStopTrying(matcher, actual)
+ matches, matcherErr = assertion.pollMatcher(matcher, actual)
+ }
+
+ renderError := func(preamble string, err error) string {
+ message := ""
+ if pollingSignalErr, ok := AsPollingSignalError(err); ok {
+ message = err.Error()
+ for _, attachment := range pollingSignalErr.Attachments {
+ message += fmt.Sprintf("\n%s:\n", attachment.Description)
+ message += format.Object(attachment.Object, 1)
+ }
+ } else {
+ message = preamble + "\n" + err.Error() + "\n" + format.Object(err, 1)
+ }
+ return message
}
messageGenerator := func() string {
@@ -349,23 +422,45 @@ func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch
lock.Lock()
defer lock.Unlock()
message := ""
- if err != nil {
- if pollingSignalErr, ok := AsPollingSignalError(err); ok && pollingSignalErr.IsStopTrying() {
- message = err.Error()
- for _, attachment := range pollingSignalErr.Attachments {
- message += fmt.Sprintf("\n%s:\n", attachment.Description)
- message += format.Object(attachment.Object, 1)
+
+ if actualErr == nil {
+ if matcherErr == nil {
+ if desiredMatch {
+ message += matcher.FailureMessage(actual)
+ } else {
+ message += matcher.NegatedFailureMessage(actual)
}
} else {
- message = "Error: " + err.Error() + "\n" + format.Object(err, 1)
+ var fgErr formattedGomegaError
+ if errors.As(actualErr, &fgErr) {
+ message += fgErr.FormattedGomegaError() + "\n"
+ } else {
+ message += renderError(fmt.Sprintf("The matcher passed to %s returned the following error:", assertion.asyncType), matcherErr)
+ }
}
} else {
- if desiredMatch {
- message = matcher.FailureMessage(value)
+ var fgErr formattedGomegaError
+ if errors.As(actualErr, &fgErr) {
+ message += fgErr.FormattedGomegaError() + "\n"
} else {
- message = matcher.NegatedFailureMessage(value)
+ message += renderError(fmt.Sprintf("The function passed to %s returned the following error:", assertion.asyncType), actualErr)
+ }
+ if hasLastValidActual {
+ message += fmt.Sprintf("\nAt one point, however, the function did return successfully.\nYet, %s failed because", assertion.asyncType)
+ _, e := matcher.Match(lastValidActual)
+ if e != nil {
+ message += renderError(" the matcher returned the following error:", e)
+ } else {
+ message += " the matcher was not satisfied:\n"
+ if desiredMatch {
+ message += matcher.FailureMessage(lastValidActual)
+ } else {
+ message += matcher.NegatedFailureMessage(lastValidActual)
+ }
+ }
}
}
+
description := assertion.buildDescription(optionalDescription...)
return fmt.Sprintf("%s%s", description, message)
}
@@ -384,30 +479,39 @@ func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch
}
}
+ // Used to count the number of times in a row a step passed
+ passedRepeatedlyCount := 0
for {
var nextPoll <-chan time.Time = nil
var isTryAgainAfterError = false
- if pollingSignalErr, ok := AsPollingSignalError(err); ok {
- if pollingSignalErr.IsStopTrying() {
- fail("Told to stop trying")
- return false
- }
- if pollingSignalErr.IsTryAgainAfter() {
- nextPoll = time.After(pollingSignalErr.TryAgainDuration())
- isTryAgainAfterError = true
+ for _, err := range []error{actualErr, matcherErr} {
+ if pollingSignalErr, ok := AsPollingSignalError(err); ok {
+ if pollingSignalErr.IsStopTrying() {
+ fail("Told to stop trying")
+ return false
+ }
+ if pollingSignalErr.IsTryAgainAfter() {
+ nextPoll = time.After(pollingSignalErr.TryAgainDuration())
+ isTryAgainAfterError = true
+ }
}
}
- if err == nil && matches == desiredMatch {
+ if actualErr == nil && matcherErr == nil && matches == desiredMatch {
if assertion.asyncType == AsyncAssertionTypeEventually {
- return true
+ passedRepeatedlyCount += 1
+ if passedRepeatedlyCount == assertion.mustPassRepeatedly {
+ return true
+ }
}
} else if !isTryAgainAfterError {
if assertion.asyncType == AsyncAssertionTypeConsistently {
fail("Failed")
return false
}
+ // Reset the consecutive pass count
+ passedRepeatedlyCount = 0
}
if oracleMatcherSaysStop {
@@ -425,15 +529,19 @@ func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch
select {
case <-nextPoll:
- v, e := pollActual()
+ a, e := pollActual()
lock.Lock()
- value, err = v, e
+ actual, actualErr = a, e
lock.Unlock()
- if err == nil {
- oracleMatcherSaysStop = assertion.matcherSaysStopTrying(matcher, value)
- m, e := assertion.pollMatcher(matcher, value)
+ if actualErr == nil {
+ lock.Lock()
+ lastValidActual = actual
+ hasLastValidActual = true
+ lock.Unlock()
+ oracleMatcherSaysStop = assertion.matcherSaysStopTrying(matcher, actual)
+ m, e := assertion.pollMatcher(matcher, actual)
lock.Lock()
- matches, err = m, e
+ matches, matcherErr = m, e
lock.Unlock()
}
case <-contextDone:
diff --git a/vendor/github.com/onsi/gomega/internal/gomega.go b/vendor/github.com/onsi/gomega/internal/gomega.go
index 2d92877f..de1f4f33 100644
--- a/vendor/github.com/onsi/gomega/internal/gomega.go
+++ b/vendor/github.com/onsi/gomega/internal/gomega.go
@@ -109,7 +109,7 @@ func (g *Gomega) makeAsyncAssertion(asyncAssertionType AsyncAssertionType, offse
}
}
- return NewAsyncAssertion(asyncAssertionType, actual, g, timeoutInterval, pollingInterval, ctx, offset)
+ return NewAsyncAssertion(asyncAssertionType, actual, g, timeoutInterval, pollingInterval, 1, ctx, offset)
}
func (g *Gomega) SetDefaultEventuallyTimeout(t time.Duration) {
diff --git a/vendor/github.com/onsi/gomega/matchers.go b/vendor/github.com/onsi/gomega/matchers.go
index 857586a9..44056ad6 100644
--- a/vendor/github.com/onsi/gomega/matchers.go
+++ b/vendor/github.com/onsi/gomega/matchers.go
@@ -349,6 +349,20 @@ func ConsistOf(elements ...interface{}) types.GomegaMatcher {
}
}
+// HaveExactElemets succeeds if actual contains elements that precisely match the elemets passed into the matcher. The ordering of the elements does matter.
+// By default HaveExactElements() uses Equal() to match the elements, however custom matchers can be passed in instead. Here are some examples:
+//
+// Expect([]string{"Foo", "FooBar"}).Should(HaveExactElements("Foo", "FooBar"))
+// Expect([]string{"Foo", "FooBar"}).Should(HaveExactElements("Foo", ContainSubstring("Bar")))
+// Expect([]string{"Foo", "FooBar"}).Should(HaveExactElements(ContainSubstring("Foo"), ContainSubstring("Foo")))
+//
+// Actual must be an array or slice.
+func HaveExactElements(elements ...interface{}) types.GomegaMatcher {
+ return &matchers.HaveExactElementsMatcher{
+ Elements: elements,
+ }
+}
+
// ContainElements succeeds if actual contains the passed in elements. The ordering of the elements does not matter.
// By default ContainElements() uses Equal() to match the elements, however custom matchers can be passed in instead. Here are some examples:
//
diff --git a/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go b/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go
new file mode 100644
index 00000000..19d8f3d1
--- /dev/null
+++ b/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go
@@ -0,0 +1,75 @@
+package matchers
+
+import (
+ "fmt"
+
+ "github.com/onsi/gomega/format"
+)
+
+type mismatchFailure struct {
+ failure string
+ index int
+}
+
+type HaveExactElementsMatcher struct {
+ Elements []interface{}
+ mismatchFailures []mismatchFailure
+ missingIndex int
+ extraIndex int
+}
+
+func (matcher *HaveExactElementsMatcher) Match(actual interface{}) (success bool, err error) {
+ if isMap(actual) {
+ return false, fmt.Errorf("error")
+ }
+
+ matchers := matchers(matcher.Elements)
+ values := valuesOf(actual)
+
+ lenMatchers := len(matchers)
+ lenValues := len(values)
+
+ for i := 0; i < lenMatchers || i < lenValues; i++ {
+ if i >= lenMatchers {
+ matcher.extraIndex = i
+ continue
+ }
+
+ if i >= lenValues {
+ matcher.missingIndex = i
+ return
+ }
+
+ elemMatcher := matchers[i].(omegaMatcher)
+ match, err := elemMatcher.Match(values[i])
+ if err != nil || !match {
+ matcher.mismatchFailures = append(matcher.mismatchFailures, mismatchFailure{
+ index: i,
+ failure: elemMatcher.FailureMessage(values[i]),
+ })
+ }
+ }
+
+ return matcher.missingIndex+matcher.extraIndex+len(matcher.mismatchFailures) == 0, nil
+}
+
+func (matcher *HaveExactElementsMatcher) FailureMessage(actual interface{}) (message string) {
+ message = format.Message(actual, "to have exact elements with", presentable(matcher.Elements))
+ if matcher.missingIndex > 0 {
+ message = fmt.Sprintf("%s\nthe missing elements start from index %d", message, matcher.missingIndex)
+ }
+ if matcher.extraIndex > 0 {
+ message = fmt.Sprintf("%s\nthe extra elements start from index %d", message, matcher.extraIndex)
+ }
+ if len(matcher.mismatchFailures) != 0 {
+ message = fmt.Sprintf("%s\nthe mismatch indexes were:", message)
+ }
+ for _, mismatch := range matcher.mismatchFailures {
+ message = fmt.Sprintf("%s\n%d: %s", message, mismatch.index, mismatch.failure)
+ }
+ return
+}
+
+func (matcher *HaveExactElementsMatcher) NegatedFailureMessage(actual interface{}) (message string) {
+ return format.Message(actual, "not to contain elements", presentable(matcher.Elements))
+}
diff --git a/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go
index c8993a86..827475ea 100644
--- a/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go
+++ b/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go
@@ -25,7 +25,17 @@ func (matcher *MatchErrorMatcher) Match(actual interface{}) (success bool, err e
expected := matcher.Expected
if isError(expected) {
- return reflect.DeepEqual(actualErr, expected) || errors.Is(actualErr, expected.(error)), nil
+ // first try the built-in errors.Is
+ if errors.Is(actualErr, expected.(error)) {
+ return true, nil
+ }
+ // if not, try DeepEqual along the error chain
+ for unwrapped := actualErr; unwrapped != nil; unwrapped = errors.Unwrap(unwrapped) {
+ if reflect.DeepEqual(unwrapped, expected) {
+ return true, nil
+ }
+ }
+ return false, nil
}
if isString(expected) {
diff --git a/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go b/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go
index 721ed552..da5a3959 100644
--- a/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go
+++ b/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go
@@ -1,11 +1,16 @@
package matchers
import (
+ "errors"
"fmt"
"github.com/onsi/gomega/format"
)
+type formattedGomegaError interface {
+ FormattedGomegaError() string
+}
+
type SucceedMatcher struct {
}
@@ -25,6 +30,10 @@ func (matcher *SucceedMatcher) Match(actual interface{}) (success bool, err erro
}
func (matcher *SucceedMatcher) FailureMessage(actual interface{}) (message string) {
+ var fgErr formattedGomegaError
+ if errors.As(actual.(error), &fgErr) {
+ return fgErr.FormattedGomegaError()
+ }
return fmt.Sprintf("Expected success, but got an error:\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1))
}
diff --git a/vendor/github.com/onsi/gomega/types/types.go b/vendor/github.com/onsi/gomega/types/types.go
index 125de649..7c7adb94 100644
--- a/vendor/github.com/onsi/gomega/types/types.go
+++ b/vendor/github.com/onsi/gomega/types/types.go
@@ -75,6 +75,7 @@ type AsyncAssertion interface {
ProbeEvery(interval time.Duration) AsyncAssertion
WithContext(ctx context.Context) AsyncAssertion
WithArguments(argsToForward ...interface{}) AsyncAssertion
+ MustPassRepeatedly(count int) AsyncAssertion
}
// Assertions are returned by Ω and Expect and enable assertions against Gomega matchers
diff --git a/vendor/github.com/vmware/govmomi/.gitignore b/vendor/github.com/vmware/govmomi/.gitignore
index a7d3e830..675d86a0 100644
--- a/vendor/github.com/vmware/govmomi/.gitignore
+++ b/vendor/github.com/vmware/govmomi/.gitignore
@@ -10,3 +10,4 @@ dist/
# Ignore editor temp files
*~
+.vscode/
diff --git a/vendor/github.com/vmware/govmomi/CHANGELOG.md b/vendor/github.com/vmware/govmomi/CHANGELOG.md
index 72c3a41f..974881f9 100644
--- a/vendor/github.com/vmware/govmomi/CHANGELOG.md
+++ b/vendor/github.com/vmware/govmomi/CHANGELOG.md
@@ -1,6 +1,94 @@
+
+## [Release v0.29.0](https://github.com/vmware/govmomi/compare/v0.28.0...v0.29.0)
+
+> Release Date: 2022-07-06
+
+### 🐞 Fix
+
+- [d6dd8fb3] Typos in vim25/soap/client CA tests
+- [e086dfe4] generate negative device key in AssignController
+- [371a24a4] Interface conversion panic in pkg simulator
+- [a982c033] use correct controlflag for vslm SetControlFlags API test
+- [37b3b24c] avoid possible panic in govc metric commands
+- [310516e2] govc: disambiguate vm/host search flags in vm.migrate
+- [6af2cdc3] govc-tests in Go v1.18
+- [142cdca4] Security update golangci-lint
+- [971079ba] use correct vcenter.DeploymentSpec.VmConfigSpec json tag
+
+### 💫 API Changes
+
+- [e6b5974a] Add versioned user-agent header
+- [ca7ee510] add VmConfigSpec field to content library DeploymentSpec
+
+### 💫 `govc` (CLI)
+
+- [515ca29f] Use unique searchFlagKey when calling NewSearchFlag
+- [9d4ca658] add library.deploy '-config' flag
+- [fc17df08] add 'device.clock.add' command
+- [11f2d453] Edit disk storage IO
+
+### 💫 `vcsim` (Simulator)
+
+- [a1a36c9a] Fix disk capacity fields in ReconfigVM_Task
+- [361c90ca] Remove VM Guest.Net entry when removing Ethernet card
+- [578b95e5] Fix createVM to encode VM name
+- [3325da0c] add content library VmConfigSpec support
+- [8928a489] Update Dockerfile
+
+### 📃 Documentation
+
+- [5f5fb51e] Fix broken link in PR template
+
+### 🧹 Chore
+
+- [69ac8494] Update version.go for v0.29.0
+- [80489cb5] Update release automation
+- [e1f76e37] Add missing copyright header
+- [6ed812fe] Add Go boilerplate check
+
+### ⚠️ BREAKING
+
+### 📖 Commits
+
+- [69ac8494] chore: Update version.go for v0.29.0
+- [7d3b2b39] Update generated types
+- [a1a36c9a] vcsim: Fix disk capacity fields in ReconfigVM_Task
+- [5f5fb51e] docs: Fix broken link in PR template
+- [d6dd8fb3] fix: Typos in vim25/soap/client CA tests
+- [e086dfe4] fix: generate negative device key in AssignController
+- [361c90ca] vcsim: Remove VM Guest.Net entry when removing Ethernet card
+- [80489cb5] chore: Update release automation
+- [e6b5974a] api: Add versioned user-agent header
+- [578b95e5] vcsim: Fix createVM to encode VM name
+- [371a24a4] fix: Interface conversion panic in pkg simulator
+- [a982c033] fix: use correct controlflag for vslm SetControlFlags API test
+- [37b3b24c] fix: avoid possible panic in govc metric commands
+- [310516e2] fix: govc: disambiguate vm/host search flags in vm.migrate
+- [5929abfb] correct SetControlFlags and ClearControlFlags APIs
+- [6af2cdc3] fix: govc-tests in Go v1.18
+- [e1f76e37] chore: Add missing copyright header
+- [6ed812fe] chore: Add Go boilerplate check
+- [142cdca4] fix: Security update golangci-lint
+- [3f4993d4] build(deps): bump chuhlomin/render-template from 1.4 to 1.5
+- [971079ba] fix: use correct vcenter.DeploymentSpec.VmConfigSpec json tag
+- [892dcfcc] build(deps): bump nokogiri from 1.13.5 to 1.13.6 in /gen
+- [303f0d95] build(deps): bump goreleaser/goreleaser-action from 2 to 3
+- [7eef76c3] build(deps): bump nokogiri from 1.13.4 to 1.13.5 in /gen
+- [515ca29f] govc: Use unique searchFlagKey when calling NewSearchFlag
+- [9d4ca658] govc: add library.deploy '-config' flag
+- [c5ebd552] fix:fail to add ssd disk into allflash disk group Closes: [#2846](https://github.com/vmware/govmomi/issues/2846)
+- [88f48e02] Updated USAGE.md
+- [3325da0c] vcsim: add content library VmConfigSpec support
+- [ca7ee510] api: add VmConfigSpec field to content library DeploymentSpec
+- [8928a489] vcsim: Update Dockerfile
+- [bf5d054d] Fixed docs for govc library.info w/-json
+- [2f9fab55] emacs: fix json mode
+- [fc17df08] govc: add 'device.clock.add' command
+- [11f2d453] govc: Edit disk storage IO
+
-## [Release v0.28.0](https://github.com/vmware/govmomi/compare/v0.27.4...v0.28.0)
+## [Release v0.28.0](https://github.com/vmware/govmomi/compare/v0.27.5...v0.28.0)
> Release Date: 2022-04-27
@@ -187,6 +275,22 @@ in `vcsim` are not changed.
- [48f7a881] vcsim: emit VmMigratedEvent in RelocateVM method
- [bb4f739b] Support finding Portgroups by ID in Finder.Network
+
+## [Release v0.27.5](https://github.com/vmware/govmomi/compare/v0.27.4...v0.27.5)
+
+> Release Date: 2022-06-02
+
+### 🐞 Fix
+
+- [e97c9708] use correct controlflag for vslm SetControlFlags API test
+
+### ⚠️ BREAKING
+
+### 📖 Commits
+
+- [e97c9708] fix: use correct controlflag for vslm SetControlFlags API test
+- [f8cf9ef7] correct SetControlFlags and ClearControlFlags APIs
+
## [Release v0.27.4](https://github.com/vmware/govmomi/compare/v0.27.3...v0.27.4)
diff --git a/vendor/github.com/vmware/govmomi/CONTRIBUTORS b/vendor/github.com/vmware/govmomi/CONTRIBUTORS
index 8a23a1d8..ef8c56de 100644
--- a/vendor/github.com/vmware/govmomi/CONTRIBUTORS
+++ b/vendor/github.com/vmware/govmomi/CONTRIBUTORS
@@ -6,7 +6,9 @@
Abhijeet Kasurde
abrarshivani
Adam Chalkley
+Adam Fowler
Adam Shannon
+Akanksha Panse
Al Biheiri
Alessandro Cortiana
Alex
@@ -28,6 +30,7 @@ aniketGslab
Ankit Vaidya
Ankur Huralikoppi
Anna Carrigan
+Antony Saba
Ariel Chinn
Arran Walker
Artem Anisimov
@@ -41,14 +44,18 @@ Ben Corrie
Ben Vickers
Benjamin Davini
Benjamin Peterson
+Benjamin Vickers
Bhavya Choudhary
Bob Killen
Brad Fitzpatrick
+Brian Rak
brian57860
Bruce Downs
+Bryan Venteicher
Cédric Blomart
Cheng Cheng
Chethan Venkatesh
+Choudhury Sarada Prasanna Nanda
Chris Marchesi
Christian Höltje
Clint Greenwood
@@ -66,19 +73,24 @@ David Gress
David Stark
Davide Agnello
Davinder Kumar
+Defa
demarey
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Deric Crago
+ditsuke
Divyen Patel
Dnyanesh Gate
Doug MacEachern
East <60801291+houfangdong@users.noreply.github.com>
Eloy Coto
+embano1
+Eng Zer Jun
Eric Edens
Eric Graham <16710890+Pheric@users.noreply.github.com>
Eric Gray
Eric Yutao
Erik Hollensbe
+Essodjolo KAHANAM
Ethan Kaley
Evan Chu
Fabio Rapposelli
@@ -94,9 +106,11 @@ Gerrit Renker
gthombare
HakanSunay
Hasan Mahmood
+Haydon Ryan
Heiko Reese
Henrik Hodne
hkumar
+Hrabur Stoyanov
hui luo
Ian Eyberg
Isaac Rodman
@@ -115,6 +129,7 @@ Jorge Sevilla
Julien PILLON
Justin J. Novack
kayrus
+Keenan Brock
Kevin George
Knappek
Leslie Wang
@@ -124,13 +139,17 @@ Liping Xue
Louie Jiang
Luther Monson
Madanagopal Arunachalam
+makelarisjr <8687447+makelarisjr@users.noreply.github.com>
maplain
Marc Carmier
Marcus Tan
Maria Ntalla
Marin Atanasov Nikolov
Mario Trangoni
+Mark Dechiaro
Mark Peek
+Mark Rexwinkel
+martin
Matt Clay
Matt Moore
Matt Moriarity
@@ -138,14 +157,19 @@ Matthew Cosgrove
mbhadale
Merlijn Sebrechts
Mevan Samaratunga
+Michael Gasch <15986659+embano1@users.noreply.github.com>
Michael Gasch
Michal Jankowski
+Mike Schinkel
Mincho Tonev
mingwei
Nicolas Lamirault
Nikhil Kathare
Nikhil R Deshpande
Nikolas Grottendieck
+Nils Elde
+nirbhay
+Nobuhiro MIKI
Om Kumar
Omar Kohl
Parham Alvani
@@ -153,15 +177,24 @@ Parveen Chahal
Paul Martin <25058109+rawstorage@users.noreply.github.com>
Pierre Gronlier
Pieter Noordhuis
+pradeepj <50135054+pradeep288@users.noreply.github.com>
+Pranshu Jain
prydin
rconde01
rHermes
+Rianto Wahyudi
+Ricardo Katz
+Robin Watkins
Rowan Jacobs
Roy Ling
rsikdar
runner.mei
+Ryan Johnson
+S R Ashrith
S.Çağlar Onur
Saad Malik
+Sam Zhu
+samzhu333 <45263849+samzhu333@users.noreply.github.com>
Sandeep Pissay Srinivasa Rao
Scott Holden
Sergey Ignatov
@@ -172,11 +205,15 @@ Shaozhen Ding
Shawn Neal
shylasrinivas
sky-joker
+smaftoul
+smahadik
Sten Feldman
Stepan Mazurov
Steve Purcell
+Sudhindra Aithal
SUMIT AGRAWAL
-Syuparn
+Sunny Carter
+syuparn
Takaaki Furukawa
Tamas Eger
Tanay Kothari
@@ -198,11 +235,13 @@ Waldek Maleska
William Lam
Witold Krecicki
xing-yang
+xinyanw409
Yang Yang
yangxi
Yann Hodique
Yash Nitin Desai
Yassine TIJANI
+Yi Jiang
yiyingy
ykakarap
Yogesh Sobale <6104071+ysobale@users.noreply.github.com>
diff --git a/vendor/github.com/vmware/govmomi/README.md b/vendor/github.com/vmware/govmomi/README.md
index 96588f02..60a18d6e 100644
--- a/vendor/github.com/vmware/govmomi/README.md
+++ b/vendor/github.com/vmware/govmomi/README.md
@@ -1,39 +1,33 @@
-[![Build](https://github.com/vmware/govmomi/actions/workflows/govmomi-build.yaml/badge.svg)](https://github.com/vmware/govmomi/actions/workflows/govmomi-build.yaml)
-[![Tests](https://github.com/vmware/govmomi/actions/workflows/govmomi-go-tests.yaml/badge.svg)](https://github.com/vmware/govmomi/actions/workflows/govmomi-go-tests.yaml)
-[![Go Report Card](https://goreportcard.com/badge/github.com/vmware/govmomi)](https://goreportcard.com/report/github.com/vmware/govmomi)
-[![Latest Release](https://img.shields.io/github/release/vmware/govmomi.svg?logo=github&style=flat-square)](https://github.com/vmware/govmomi/releases/latest)
-[![Go Reference](https://pkg.go.dev/badge/github.com/vmware/govmomi.svg)](https://pkg.go.dev/github.com/vmware/govmomi)
-[![go.mod Go version](https://img.shields.io/github/go-mod/go-version/vmware/govmomi)](https://github.com/vmware/govmomi)
+
+
+[![Build](https://github.com/vmware/govmomi/actions/workflows/govmomi-build.yaml/badge.svg)][ci-build]
+[![Tests](https://github.com/vmware/govmomi/actions/workflows/govmomi-go-tests.yaml/badge.svg)][ci-tests]
+[![Go Report Card](https://goreportcard.com/badge/github.com/vmware/govmomi)][go-report-card]
+[![Latest Release](https://img.shields.io/github/release/vmware/govmomi.svg?logo=github&style=flat-square)][latest-release]
+[![Go Reference](https://pkg.go.dev/badge/github.com/vmware/govmomi.svg)][go-reference]
+[![go.mod Go version](https://img.shields.io/github/go-mod/go-version/vmware/govmomi)][go-version]
# govmomi
-A Go library for interacting with VMware vSphere APIs (ESXi and/or vCenter).
+A Go library for interacting with VMware vSphere APIs (ESXi and/or vCenter Server).
In addition to the vSphere API client, this repository includes:
-* [govc](./govc) - vSphere CLI
-
-* [vcsim](./vcsim) - vSphere API mock framework
-
-* [toolbox](./toolbox) - VM guest tools framework
+* [govc][govc] - vSphere CLI
+* [vcsim][vcsim] - vSphere API mock framework
+* [toolbox][toolbox] - VM guest tools framework
## Compatibility
-This library is built for and tested against ESXi and vCenter 6.5, 6.7 and 7.0.
+This library supports vCenter Server and ESXi versions following the [VMware Product Lifecycle Matrix][reference-lifecycle].
-It may work with versions 5.1, 5.5 and 6.0, but neither are officially supported.
+Product versions that are end of support may work, but are not officially supported.
## Documentation
-The APIs exposed by this library very closely follow the API described in the [VMware vSphere API Reference Documentation][apiref].
-Refer to this document to become familiar with the upstream API.
-
-The code in the `govmomi` package is a wrapper for the code that is generated from the vSphere API description.
-It primarily provides convenience functions for working with the vSphere API.
-See [godoc.org][godoc] for documentation.
+The APIs exposed by this library closely follow the API described in the [VMware vSphere API Reference Documentation][reference-api]. Refer to the documentation to become familiar with the upstream API.
-[apiref]:https://code.vmware.com/apis/968/vsphere
-[godoc]:http://godoc.org/github.com/vmware/govmomi
+The code in the `govmomi` package is a wrapper for the code that is generated from the vSphere API description. It primarily provides convenience functions for working with the vSphere API. See [godoc.org][reference-godoc] for documentation.
## Installation
@@ -45,77 +39,93 @@ go get -u github.com/vmware/govmomi
### Binaries and Docker Images for `govc` and `vcsim`
-Installation instructions, released binaries and Docker images are documented in
-the respective README files of [`govc`](govc/README.md) and
-[`vcsim`](vcsim/README.md).
+Installation instructions, released binaries, and Docker images are documented in the respective README files of [`govc`][govc] and [`vcsim`][vcsim].
## Discussion
-Contributors and users are encouraged to collaborate using GitHub issues and/or
-[Slack](https://vmwarecode.slack.com/messages/govmomi).
-Access to Slack requires a [VMware {code} membership](https://code.vmware.com/join/).
-
-## Status
-
-Changes to the API are subject to [semantic versioning](http://semver.org).
-
-Refer to the [CHANGELOG](CHANGELOG.md) for version to version changes.
-
-## Projects using govmomi
-* [collectd-vsphere](https://github.com/travis-ci/collectd-vsphere)
-
-* [Docker Machine](https://github.com/docker/machine/tree/master/drivers/vmwarevsphere)
-
-* [Docker InfraKit](https://github.com/docker/infrakit/tree/master/pkg/provider/vsphere)
-
-* [Docker LinuxKit](https://github.com/linuxkit/linuxkit/tree/master/src/cmd/linuxkit)
-
-* [Gru](https://github.com/dnaeon/gru)
+The project encourages the community to collaborate using GitHub [issues][govmomi-github-issues], GitHub [discussions][govmomi-github-discussions], and [Slack][slack-channel].
-* [Juju](https://github.com/juju/juju)
+> **Note**
+> Access to Slack requires a free [VMware {code}][slack-join] developer program membership.
-* [Kubernetes vSphere Cloud Provider](https://github.com/kubernetes/cloud-provider-vsphere)
-
-* [Kubernetes Cluster API](https://github.com/kubernetes-sigs/cluster-api-provider-vsphere)
-
-* [Kubernetes kops](https://github.com/kubernetes/kops/tree/master/upup/pkg/fi/cloudup/vsphere)
-
-* [Libretto](https://github.com/apcera/libretto/tree/master/virtualmachine/vsphere)
-
-* [Open Storage](https://github.com/libopenstorage/openstorage/tree/master/pkg/storageops/vsphere)
-
-* [OPS](https://github.com/nanovms/ops)
-
-* [Packer](https://github.com/jetbrains-infra/packer-builder-vsphere)
-
-* [Rancher](https://github.com/rancher/rancher/blob/master/pkg/api/norman/customization/vsphere/listers.go)
-
-* [Terraform](https://github.com/terraform-providers/terraform-provider-vsphere)
-
-* [Travis CI](https://github.com/travis-ci/jupiter-brain)
-
-* [Telegraf](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/vsphere)
+## Status
-* [VMware Event Broker Appliance](https://github.com/vmware-samples/vcenter-event-broker-appliance/tree/development/vmware-event-router)
+Changes to the API are subject to [semantic versioning][reference-semver].
-* [VMware VIC Engine](https://github.com/vmware/vic)
-
-* [vSphere 7.0](https://docs.vmware.com/en/VMware-vSphere/7.0/rn/vsphere-esxi-vcenter-server-7-vsphere-with-kubernetes-release-notes.html)
+Refer to the [CHANGELOG][govmomi-changelog] for version to version changes.
-## Related projects
+## Notable Projects Using govmomi
-* [rbvmomi](https://github.com/vmware/rbvmomi)
+* [collectd-vsphere][project-travisci-collectd-vsphere]
+* [Docker LinuxKit][project-docker-linuxKit]
+* [Elastic Agent VMware vSphere integration][project-elastic-agent]
+* [Gru][project-gru]
+* [Juju][project-juju]
+* [Jupiter Brain][project-travisci-jupiter-brain]
+* [Kubernetes vSphere Cloud Provider][project-k8s-cloud-provider]
+* [Kubernetes Cluster API][project-k8s-cluster-api]
+* [OPS][project-nanovms-ops]
+* [Packer Plugin for VMware vSphere][project-hashicorp-packer-plugin-vsphere]
+* [Rancher][project-rancher]
+* [Terraform Provider for VMware vSphere][project-hashicorp-terraform-provider-vsphere]
+* [Telegraf][project-influxdata-telegraf]
+* [VMware Event Broker Appliance][project-vmware-veba]
+* [VMware vSphere Integrated Containers Engine][project-vmware-vic]
+* [VMware vSphere 7.0][project-vmware-vsphere]
-* [pyvmomi](https://github.com/vmware/pyvmomi)
+## Related Projects
-* [go-vmware-nsxt](https://github.com/vmware/go-vmware-nsxt)
+* [go-vmware-nsxt][reference-go-vmware-nsxt]
+* [pyvmomi][reference-pyvmomi]
+* [rbvmomi][reference-rbvmomi]
## License
-govmomi is available under the [Apache 2 license](LICENSE.txt).
+govmomi is available under the [Apache 2 License][govmomi-license].
## Name
-Pronounced "go-v-mom-ie"
+Pronounced: _go·v·mom·ie_
Follows pyvmomi and rbvmomi: language prefix + the vSphere acronym "VM Object Management Infrastructure".
+
+[//]: Links
+
+[ci-build]: https://github.com/vmware/govmomi/actions/workflows/govmomi-build.yaml
+[ci-tests]: https://github.com/vmware/govmomi/actions/workflows/govmomi-go-tests.yaml
+[latest-release]: https://github.com/vmware/govmomi/releases/latest
+[govc]: govc/README.md
+[govmomi-github-issues]: https://github.com/vmware/govmomi/issues
+[govmomi-github-discussions]: https://github.com/vmware/govmomi/discussions
+[govmomi-changelog]: CHANGELOG.md
+[govmomi-license]: LICENSE.txt
+[go-reference]: https://pkg.go.dev/github.com/vmware/govmomi
+[go-report-card]: https://goreportcard.com/report/github.com/vmware/govmomi
+[go-version]: https://github.com/vmware/govmomi
+[project-docker-linuxKit]: https://github.com/linuxkit/linuxkit/tree/master/src/cmd/linuxkit
+[project-elastic-agent]: https://github.com/elastic/integrations/tree/main/packages/vsphere
+[project-gru]: https://github.com/dnaeon/gru
+[project-hashicorp-packer-plugin-vsphere]: https://github.com/hashicorp/packer-plugin-vsphere
+[project-hashicorp-terraform-provider-vsphere]: https://github.com/hashicorp/terraform-provider-vsphere
+[project-influxdata-telegraf]: https://github.com/influxdata/telegraf/tree/master/plugins/inputs/vsphere
+[project-juju]: https://github.com/juju/juju
+[project-k8s-cloud-provider]: https://github.com/kubernetes/cloud-provider-vsphere
+[project-k8s-cluster-api]: https://github.com/kubernetes-sigs/cluster-api-provider-vsphere
+[project-nanovms-ops]: https://github.com/nanovms/ops
+[project-rancher]: https://github.com/rancher/rancher/blob/master/pkg/api/norman/customization/vsphere/listers.go
+[project-travisci-collectd-vsphere]: https://github.com/travis-ci/collectd-vsphere
+[project-travisci-jupiter-brain]: https://github.com/travis-ci/jupiter-brain
+[project-vmware-veba]: https://github.com/vmware-samples/vcenter-event-broker-appliance/tree/development/vmware-event-router
+[project-vmware-vic]: https://github.com/vmware/vic
+[project-vmware-vsphere]: https://docs.vmware.com/en/VMware-vSphere/7.0/rn/vsphere-esxi-vcenter-server-7-vsphere-with-kubernetes-release-notes.html
+[reference-api]: https://developer.vmware.com/apis/968/vsphere
+[reference-godoc]: http://godoc.org/github.com/vmware/govmomi
+[reference-go-vmware-nsxt]: https://github.com/vmware/go-vmware-nsxt
+[reference-lifecycle]: https://lifecycle.vmware.com
+[reference-pyvmomi]: https://github.com/vmware/pyvmomi
+[reference-rbvmomi]: https://github.com/vmware/rbvmomi
+[reference-semver]: http://semver.org
+[slack-join]: https://developer.vmware.com/join/
+[slack-channel]: https://vmwarecode.slack.com/messages/govmomi
+[toolbox]: toolbox/README.md
+[vcsim]: vcsim/README.md
diff --git a/vendor/github.com/vmware/govmomi/cns/client.go b/vendor/github.com/vmware/govmomi/cns/client.go
index e4097f90..037ac2e9 100644
--- a/vendor/github.com/vmware/govmomi/cns/client.go
+++ b/vendor/github.com/vmware/govmomi/cns/client.go
@@ -269,3 +269,16 @@ func (c *Client) QuerySnapshots(ctx context.Context, snapshotQueryFilter cnstype
}
return object.NewTask(c.vim25Client, res.Returnval), nil
}
+
+// ReconfigVolumePolicy calls the CnsReconfigVolumePolicy API
+func (c *Client) ReconfigVolumePolicy(ctx context.Context, PolicyReconfigSpecs []cnstypes.CnsVolumePolicyReconfigSpec) (*object.Task, error) {
+ req := cnstypes.CnsReconfigVolumePolicy{
+ This: CnsVolumeManagerInstance,
+ VolumePolicyReconfigSpecs: PolicyReconfigSpecs,
+ }
+ res, err := methods.CnsReconfigVolumePolicy(ctx, c, &req)
+ if err != nil {
+ return nil, err
+ }
+ return object.NewTask(c.vim25Client, res.Returnval), nil
+}
diff --git a/vendor/github.com/vmware/govmomi/cns/methods/methods.go b/vendor/github.com/vmware/govmomi/cns/methods/methods.go
index 6f0e0d0a..43f41f3a 100644
--- a/vendor/github.com/vmware/govmomi/cns/methods/methods.go
+++ b/vendor/github.com/vmware/govmomi/cns/methods/methods.go
@@ -326,3 +326,23 @@ func CnsQuerySnapshots(ctx context.Context, r soap.RoundTripper, req *types.CnsQ
return resBody.Res, nil
}
+
+type CnsReconfigVolumePolicyBody struct {
+ Req *types.CnsReconfigVolumePolicy `xml:"urn:vsan CnsReconfigVolumePolicy,omitempty"`
+ Res *types.CnsReconfigVolumePolicyResponse `xml:"urn:vsan CnsReconfigVolumePolicyResponse,omitempty"`
+ Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
+}
+
+func (b *CnsReconfigVolumePolicyBody) Fault() *soap.Fault { return b.Fault_ }
+
+func CnsReconfigVolumePolicy(ctx context.Context, r soap.RoundTripper, req *types.CnsReconfigVolumePolicy) (*types.CnsReconfigVolumePolicyResponse, error) {
+ var reqBody, resBody CnsReconfigVolumePolicyBody
+
+ reqBody.Req = req
+
+ if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
+ return nil, err
+ }
+
+ return resBody.Res, nil
+}
diff --git a/vendor/github.com/vmware/govmomi/cns/types/enum.go b/vendor/github.com/vmware/govmomi/cns/types/enum.go
index 53f0580b..09186eea 100644
--- a/vendor/github.com/vmware/govmomi/cns/types/enum.go
+++ b/vendor/github.com/vmware/govmomi/cns/types/enum.go
@@ -55,6 +55,8 @@ const (
QuerySelectionNameTypeComplianceStatus = QuerySelectionNameType("COMPLIANCE_STATUS")
QuerySelectionNameTypeDataStoreAccessibility = QuerySelectionNameType("DATASTORE_ACCESSIBILITY_STATUS")
QuerySelectionNameTypeHealthStatus = QuerySelectionNameType("HEALTH_STATUS")
+ QuerySelectionNameTypeDataStoreUrl = QuerySelectionNameType("DATASTORE_URL")
+ QuerySelectionNameTypePolicyId = QuerySelectionNameType("POLICY_ID")
)
func init() {
@@ -87,6 +89,9 @@ const (
CnsQuerySelectionName_BACKING_OBJECT_DETAILS = CnsQuerySelectionNameType("BACKING_OBJECT_DETAILS")
CnsQuerySelectionName_COMPLIANCE_STATUS = CnsQuerySelectionNameType("COMPLIANCE_STATUS")
CnsQuerySelectionName_DATASTORE_ACCESSIBILITY_STATUS = CnsQuerySelectionNameType("DATASTORE_ACCESSIBILITY_STATUS")
+ CnsQuerySelectionName_HEALTH_STATUS = CnsQuerySelectionNameType("HEALTH_STATUS")
+ CnsQuerySelectionName_DATASTORE_URL = CnsQuerySelectionNameType("DATASTORE_URL")
+ CnsQuerySelectionName_POLICY_ID = CnsQuerySelectionNameType("POLICY_ID")
)
func init() {
diff --git a/vendor/github.com/vmware/govmomi/cns/types/types.go b/vendor/github.com/vmware/govmomi/cns/types/types.go
index c5fb2812..452b9ed3 100644
--- a/vendor/github.com/vmware/govmomi/cns/types/types.go
+++ b/vendor/github.com/vmware/govmomi/cns/types/types.go
@@ -392,8 +392,8 @@ func init() {
type CnsBlockBackingDetails struct {
CnsBackingObjectDetails
- BackingDiskId string `xml:"backingDiskId,omitempty"`
- BackingDiskUrlPath string `xml:"backingDiskUrlPath,omitempty"`
+ BackingDiskId string `xml:"backingDiskId,omitempty"`
+ BackingDiskUrlPath string `xml:"backingDiskUrlPath,omitempty"`
BackingDiskObjectId string `xml:"backingDiskObjectId,omitempty"`
}
@@ -460,7 +460,7 @@ type CnsQueryFilter struct {
ComplianceStatus string `xml:"complianceStatus,omitempty"`
DatastoreAccessibilityStatus string `xml:"datastoreAccessibilityStatus,omitempty"`
Cursor *CnsCursor `xml:"cursor,omitempty"`
- healthStatus string `xml:"healthStatus,omitempty"`
+ HealthStatus string `xml:"healthStatus,omitempty"`
}
func init() {
@@ -879,3 +879,33 @@ type CnsSnapshotQuerySpec struct {
func init() {
types.Add("CnsSnapshotQuerySpec", reflect.TypeOf((*CnsSnapshotQuerySpec)(nil)).Elem())
}
+
+type CnsReconfigVolumePolicy CnsReconfigVolumePolicyRequestType
+
+func init() {
+ types.Add("vsan:CnsReconfigVolumePolicy", reflect.TypeOf((*CnsReconfigVolumePolicy)(nil)).Elem())
+}
+
+type CnsReconfigVolumePolicyRequestType struct {
+ This types.ManagedObjectReference `xml:"_this"`
+ VolumePolicyReconfigSpecs []CnsVolumePolicyReconfigSpec `xml:"volumePolicyReconfigSpecs,omitempty"`
+}
+
+func init() {
+ types.Add("vsan:CnsReconfigVolumePolicyRequestType", reflect.TypeOf((*CnsReconfigVolumePolicyRequestType)(nil)).Elem())
+}
+
+type CnsReconfigVolumePolicyResponse struct {
+ Returnval types.ManagedObjectReference `xml:"returnval"`
+}
+
+type CnsVolumePolicyReconfigSpec struct {
+ types.DynamicData
+
+ VolumeId CnsVolumeId `xml:"volumeId"`
+ Profile []types.BaseVirtualMachineProfileSpec `xml:"profile,omitempty,typeattr"`
+}
+
+func init() {
+ types.Add("vsan:CnsVolumePolicyReconfigSpec", reflect.TypeOf((*CnsVolumePolicyReconfigSpec)(nil)).Elem())
+}
diff --git a/vendor/github.com/vmware/govmomi/govc/about/cert.go b/vendor/github.com/vmware/govmomi/govc/about/cert.go
index 7cbd5c9f..d315707e 100644
--- a/vendor/github.com/vmware/govmomi/govc/about/cert.go
+++ b/vendor/github.com/vmware/govmomi/govc/about/cert.go
@@ -98,7 +98,7 @@ func (r *certResult) Write(w io.Writer) error {
func (cmd *cert) Run(ctx context.Context, f *flag.FlagSet) error {
u := cmd.Session.URL
- c := soap.NewClient(u, false)
+ c := soap.NewClient(u, cmd.Session.Insecure)
t := c.Client.Transport.(*http.Transport)
r := certResult{cmd: cmd}
diff --git a/vendor/github.com/vmware/govmomi/govc/flags/library.go b/vendor/github.com/vmware/govmomi/govc/flags/library.go
index 16883d77..3b715f45 100644
--- a/vendor/github.com/vmware/govmomi/govc/flags/library.go
+++ b/vendor/github.com/vmware/govmomi/govc/flags/library.go
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2020 VMware, Inc. All Rights Reserved.
+Copyright (c) 2020-2022 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/vendor/github.com/vmware/govmomi/govc/flags/output.go b/vendor/github.com/vmware/govmomi/govc/flags/output.go
index 565bdd15..c0338b18 100644
--- a/vendor/github.com/vmware/govmomi/govc/flags/output.go
+++ b/vendor/github.com/vmware/govmomi/govc/flags/output.go
@@ -106,8 +106,14 @@ func (flag *OutputFlag) Write(b []byte) (int, error) {
return 0, nil
}
- n, err := os.Stdout.Write(b)
- os.Stdout.Sync()
+ w := flag.Out
+ if w == nil {
+ w = os.Stdout
+ }
+ n, err := w.Write(b)
+ if w == os.Stdout {
+ os.Stdout.Sync()
+ }
return n, err
}
diff --git a/vendor/github.com/vmware/govmomi/govc/host/esxcli/esxcli.go b/vendor/github.com/vmware/govmomi/govc/host/esxcli/esxcli.go
index 88dc9cd6..6ca0cd39 100644
--- a/vendor/github.com/vmware/govmomi/govc/host/esxcli/esxcli.go
+++ b/vendor/github.com/vmware/govmomi/govc/host/esxcli/esxcli.go
@@ -71,6 +71,10 @@ func (cmd *esxcli) Process(ctx context.Context) error {
}
func (cmd *esxcli) Run(ctx context.Context, f *flag.FlagSet) error {
+ if f.NArg() == 0 {
+ return flag.ErrHelp
+ }
+
c, err := cmd.Client()
if err != nil {
return err
diff --git a/vendor/github.com/vmware/govmomi/govc/object/save.go b/vendor/github.com/vmware/govmomi/govc/object/save.go
index ce0dc3df..7d4247a8 100644
--- a/vendor/github.com/vmware/govmomi/govc/object/save.go
+++ b/vendor/github.com/vmware/govmomi/govc/object/save.go
@@ -120,10 +120,19 @@ func saveEnvironmentBrowser(ctx context.Context, c *vim25.Client, ref types.Mana
return []saveMethod{{"QueryConfigOption", res}}, nil
}
+func saveHostNetworkSystem(ctx context.Context, c *vim25.Client, ref types.ManagedObjectReference) ([]saveMethod, error) {
+ res, err := methods.QueryNetworkHint(ctx, c, &types.QueryNetworkHint{This: ref})
+ if err != nil {
+ return nil, err
+ }
+ return []saveMethod{{"QueryNetworkHint", res}}, nil
+}
+
// saveObjects maps object types to functions that can save data that isn't available via the PropertyCollector
var saveObjects = map[string]func(context.Context, *vim25.Client, types.ManagedObjectReference) ([]saveMethod, error){
"VmwareDistributedVirtualSwitch": saveDVS,
"EnvironmentBrowser": saveEnvironmentBrowser,
+ "HostNetworkSystem": saveHostNetworkSystem,
}
func (cmd *save) save(content []types.ObjectContent) error {
diff --git a/vendor/github.com/vmware/govmomi/internal/version/version.go b/vendor/github.com/vmware/govmomi/internal/version/version.go
index bb3389e5..a1620b5e 100644
--- a/vendor/github.com/vmware/govmomi/internal/version/version.go
+++ b/vendor/github.com/vmware/govmomi/internal/version/version.go
@@ -21,5 +21,5 @@ const (
ClientName = "govmomi"
// ClientVersion is the version of this SDK
- ClientVersion = "0.29.0"
+ ClientVersion = "0.30.2"
)
diff --git a/vendor/github.com/vmware/govmomi/object/virtual_device_list.go b/vendor/github.com/vmware/govmomi/object/virtual_device_list.go
index 19c91519..37655065 100644
--- a/vendor/github.com/vmware/govmomi/object/virtual_device_list.go
+++ b/vendor/github.com/vmware/govmomi/object/virtual_device_list.go
@@ -919,7 +919,13 @@ func (l VirtualDeviceList) Name(device types.BaseVirtualDevice) string {
dtype := l.Type(device)
switch dtype {
case DeviceTypeEthernet:
- key = fmt.Sprintf("%d", UnitNumber-7)
+ // Ethernet devices of UnitNumber 7-19 are non-SRIOV. Ethernet devices of
+ // UnitNumber 45-36 descending are SRIOV
+ if UnitNumber <= 45 && UnitNumber >= 36 {
+ key = fmt.Sprintf("sriov-%d", 45-UnitNumber)
+ } else {
+ key = fmt.Sprintf("%d", UnitNumber-7)
+ }
case DeviceTypeDisk:
key = fmt.Sprintf("%d-%d", d.ControllerKey, UnitNumber)
default:
diff --git a/vendor/github.com/vmware/govmomi/task/history_collector.go b/vendor/github.com/vmware/govmomi/task/history_collector.go
index dd9b70a1..7d8a6cf0 100644
--- a/vendor/github.com/vmware/govmomi/task/history_collector.go
+++ b/vendor/github.com/vmware/govmomi/task/history_collector.go
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2015 VMware, Inc. All Rights Reserved.
+Copyright (c) 2015-2022 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -38,12 +38,15 @@ func newHistoryCollector(c *vim25.Client, ref types.ManagedObjectReference) *His
}
}
-// RecentTasks returns a list of task managed objects that completed recently,
-// that are currently running, or that are queued to run.
-func (h HistoryCollector) RecentTasks(ctx context.Context) ([]types.TaskInfo, error) {
+// LatestPage returns items in the 'viewable latest page' of the task history collector.
+// As new tasks that match the collector's TaskFilterSpec are created,
+// they are added to this page, and the oldest tasks are removed from the collector to keep
+// the size of the page to that allowed by SetCollectorPageSize.
+// The "oldest task" is the one with the oldest creation time. The tasks in the returned page are unordered.
+func (h HistoryCollector) LatestPage(ctx context.Context) ([]types.TaskInfo, error) {
var o mo.TaskHistoryCollector
- err := h.Properties(ctx, h.Reference(), []string{"recentTask"}, &o)
+ err := h.Properties(ctx, h.Reference(), []string{"latestPage"}, &o)
if err != nil {
return nil, err
}
diff --git a/vendor/github.com/vmware/govmomi/vapi/internal/internal.go b/vendor/github.com/vmware/govmomi/vapi/internal/internal.go
index 68fe7975..f6584c56 100644
--- a/vendor/github.com/vmware/govmomi/vapi/internal/internal.go
+++ b/vendor/github.com/vmware/govmomi/vapi/internal/internal.go
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2018 VMware, Inc. All Rights Reserved.
+Copyright (c) 2018-2022 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -37,8 +37,10 @@ const (
LibraryItemDownloadSessionFile = "/com/vmware/content/library/item/downloadsession/file"
LocalLibraryPath = "/com/vmware/content/local-library"
SubscribedLibraryPath = "/com/vmware/content/subscribed-library"
+ SecurityPoliciesPath = "/api/content/security-policies"
SubscribedLibraryItem = "/com/vmware/content/library/subscribed-item"
Subscriptions = "/com/vmware/content/library/subscriptions"
+ TrustedCertificatesPath = "/api/content/trusted-certificates"
VCenterOVFLibraryItem = "/com/vmware/vcenter/ovf/library-item"
VCenterVMTXLibraryItem = "/vcenter/vm-template/library-items"
VCenterVM = "/vcenter/vm"
diff --git a/vendor/github.com/vmware/govmomi/vapi/library/library.go b/vendor/github.com/vmware/govmomi/vapi/library/library.go
index 254a1b6d..e5e5d089 100644
--- a/vendor/github.com/vmware/govmomi/vapi/library/library.go
+++ b/vendor/github.com/vmware/govmomi/vapi/library/library.go
@@ -36,17 +36,19 @@ type StorageBackings struct {
// Library provides methods to create, read, update, delete, and enumerate libraries.
type Library struct {
- CreationTime *time.Time `json:"creation_time,omitempty"`
- Description string `json:"description,omitempty"`
- ID string `json:"id,omitempty"`
- LastModifiedTime *time.Time `json:"last_modified_time,omitempty"`
- LastSyncTime *time.Time `json:"last_sync_time,omitempty"`
- Name string `json:"name,omitempty"`
- Storage []StorageBackings `json:"storage_backings,omitempty"`
- Type string `json:"type,omitempty"`
- Version string `json:"version,omitempty"`
- Subscription *Subscription `json:"subscription_info,omitempty"`
- Publication *Publication `json:"publish_info,omitempty"`
+ CreationTime *time.Time `json:"creation_time,omitempty"`
+ Description string `json:"description,omitempty"`
+ ID string `json:"id,omitempty"`
+ LastModifiedTime *time.Time `json:"last_modified_time,omitempty"`
+ LastSyncTime *time.Time `json:"last_sync_time,omitempty"`
+ Name string `json:"name,omitempty"`
+ Storage []StorageBackings `json:"storage_backings,omitempty"`
+ Type string `json:"type,omitempty"`
+ Version string `json:"version,omitempty"`
+ Subscription *Subscription `json:"subscription_info,omitempty"`
+ Publication *Publication `json:"publish_info,omitempty"`
+ SecurityPolicyID string `json:"security_policy_id,omitempty"`
+ UnsetSecurityPolicyID bool `json:"unset_security_policy_id,omitempty"`
}
// Subscription info
diff --git a/vendor/github.com/vmware/govmomi/vapi/library/library_item.go b/vendor/github.com/vmware/govmomi/vapi/library/library_item.go
index c596ec12..adc2101a 100644
--- a/vendor/github.com/vmware/govmomi/vapi/library/library_item.go
+++ b/vendor/github.com/vmware/govmomi/vapi/library/library_item.go
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2018 VMware, Inc. All Rights Reserved.
+Copyright (c) 2018-2022 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -47,6 +47,15 @@ type Item struct {
SourceID string `json:"source_id,omitempty"`
Type string `json:"type,omitempty"`
Version string `json:"version,omitempty"`
+
+ SecurityCompliance *bool `json:"security_compliance,omitempty"`
+ CertificateVerification *ItemCertificateVerification `json:"certificate_verification_info,omitempty"`
+}
+
+// ItemCertificateVerification contains the certificate verification status and item's signing certificate
+type ItemCertificateVerification struct {
+ Status string `json:"status"`
+ CertChain []string `json:"cert_chain,omitempty"`
}
// Patch merges updates from the given src.
diff --git a/vendor/github.com/vmware/govmomi/vapi/library/security_policy.go b/vendor/github.com/vmware/govmomi/vapi/library/security_policy.go
new file mode 100644
index 00000000..dd476635
--- /dev/null
+++ b/vendor/github.com/vmware/govmomi/vapi/library/security_policy.go
@@ -0,0 +1,63 @@
+/*
+Copyright (c) 2022-2022 VMware, Inc. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package library
+
+import (
+ "context"
+ "errors"
+ "net/http"
+
+ "github.com/vmware/govmomi/vapi/internal"
+)
+
+const (
+ OvfDefaultSecurityPolicy = "OVF default policy"
+)
+
+// ContentSecurityPoliciesInfo contains information on security policies that can
+// be used to describe security for content library items.
+type ContentSecurityPoliciesInfo struct {
+ // ItemTypeRules are rules governing the policy.
+ ItemTypeRules map[string]string `json:"item_type_rules"`
+ // Name is a human-readable identifier identifying the policy.
+ Name string `json:"name"`
+ // Policy is the unique identifier for a policy.
+ Policy string `json:"policy"`
+}
+
+// ListSecurityPolicies lists security policies
+func (c *Manager) ListSecurityPolicies(ctx context.Context) ([]ContentSecurityPoliciesInfo, error) {
+ url := c.Resource(internal.SecurityPoliciesPath)
+ var res []ContentSecurityPoliciesInfo
+ return res, c.Do(ctx, url.Request(http.MethodGet), &res)
+}
+
+func (c *Manager) DefaultOvfSecurityPolicy(ctx context.Context) (string, error) {
+ res, err := c.ListSecurityPolicies(ctx)
+
+ if err != nil {
+ return "", err
+ }
+
+ for _, policy := range res {
+ if policy.Name == OvfDefaultSecurityPolicy {
+ return policy.Policy, nil
+ }
+ }
+
+ return "", errors.New("failed to find default ovf security policy")
+}
diff --git a/vendor/github.com/vmware/govmomi/vapi/library/trusted_certificates.go b/vendor/github.com/vmware/govmomi/vapi/library/trusted_certificates.go
new file mode 100644
index 00000000..33e25a06
--- /dev/null
+++ b/vendor/github.com/vmware/govmomi/vapi/library/trusted_certificates.go
@@ -0,0 +1,70 @@
+/*
+Copyright (c) 2022-2022 VMware, Inc. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package library
+
+import (
+ "context"
+ "net/http"
+ "path"
+
+ "github.com/vmware/govmomi/vapi/internal"
+)
+
+// TrustedCertificate contains a trusted certificate in Base64 encoded PEM format
+type TrustedCertificate struct {
+ Text string `json:"cert_text"`
+}
+
+// TrustedCertificateSummary contains a trusted certificate in Base64 encoded PEM format and its id
+type TrustedCertificateSummary struct {
+ TrustedCertificate
+ ID string `json:"certificate"`
+}
+
+// ListTrustedCertificates retrieves all content library's trusted certificates
+func (c *Manager) ListTrustedCertificates(ctx context.Context) ([]TrustedCertificateSummary, error) {
+ url := c.Resource(internal.TrustedCertificatesPath)
+ var res struct {
+ Certificates []TrustedCertificateSummary `json:"certificates"`
+ }
+ err := c.Do(ctx, url.Request(http.MethodGet), &res)
+ return res.Certificates, err
+}
+
+// GetTrustedCertificate retrieves a trusted certificate for a given certificate id
+func (c *Manager) GetTrustedCertificate(ctx context.Context, id string) (*TrustedCertificate, error) {
+ url := c.Resource(path.Join(internal.TrustedCertificatesPath, id))
+ var res TrustedCertificate
+ err := c.Do(ctx, url.Request(http.MethodGet), &res)
+ if err != nil {
+ return nil, err
+ }
+ return &res, nil
+}
+
+// CreateTrustedCertificate adds a certificate to content library trust store
+func (c *Manager) CreateTrustedCertificate(ctx context.Context, cert string) error {
+ url := c.Resource(internal.TrustedCertificatesPath)
+ body := TrustedCertificate{Text: cert}
+ return c.Do(ctx, url.Request(http.MethodPost, body), nil)
+}
+
+// DeleteTrustedCertificate deletes the trusted certificate from content library's trust store for the given id
+func (c *Manager) DeleteTrustedCertificate(ctx context.Context, id string) error {
+ url := c.Resource(path.Join(internal.TrustedCertificatesPath, id))
+ return c.Do(ctx, url.Request(http.MethodDelete), nil)
+}
diff --git a/vendor/github.com/vmware/govmomi/vim25/soap/client.go b/vendor/github.com/vmware/govmomi/vim25/soap/client.go
index 5c63bcc9..e46a17f9 100644
--- a/vendor/github.com/vmware/govmomi/vim25/soap/client.go
+++ b/vendor/github.com/vmware/govmomi/vim25/soap/client.go
@@ -156,10 +156,14 @@ func NewClient(u *url.URL, insecure bool) *Client {
c.hosts = make(map[string]string)
c.t.TLSClientConfig = &tls.Config{InsecureSkipVerify: c.k}
- // Don't bother setting DialTLS if InsecureSkipVerify=true
- if !c.k {
- c.t.DialTLS = c.dialTLS
- }
+
+ // Always set DialTLS and DialTLSContext, even if InsecureSkipVerify=true,
+ // because of how certificate verification has been delegated to the host's
+ // PKI framework in Go 1.18. Please see the following links for more info:
+ //
+ // * https://tip.golang.org/doc/go1.18 (search for "Certificate.Verify")
+ // * https://github.com/square/certigo/issues/264
+ c.t.DialTLSContext = c.dialTLSContext
c.Client.Transport = c.t
c.Client.Jar, _ = cookiejar.New(nil)
@@ -352,7 +356,10 @@ func ThumbprintSHA1(cert *x509.Certificate) string {
return strings.Join(hex, ":")
}
-func (c *Client) dialTLS(network string, addr string) (net.Conn, error) {
+func (c *Client) dialTLSContext(
+ ctx context.Context,
+ network, addr string) (net.Conn, error) {
+
// Would be nice if there was a tls.Config.Verify func,
// see tls.clientHandshakeState.doFullHandshake
@@ -366,7 +373,20 @@ func (c *Client) dialTLS(network string, addr string) (net.Conn, error) {
case x509.UnknownAuthorityError:
case x509.HostnameError:
default:
- return nil, err
+ // Allow a thumbprint verification attempt if the error indicates
+ // the failure was due to lack of trust.
+ //
+ // Please note the err variable is not a special type of x509 or HTTP
+ // error that can be validated by a type assertion. The err variable is
+ // in fact an *errors.errorString.
+ switch {
+ case strings.HasSuffix(err.Error(), "certificate is not trusted"):
+ // darwin and linux
+ case strings.HasSuffix(err.Error(), "certificate signed by unknown authority"):
+ // windows
+ default:
+ return nil, err
+ }
}
thumbprint := c.Thumbprint(addr)
@@ -391,6 +411,10 @@ func (c *Client) dialTLS(network string, addr string) (net.Conn, error) {
return conn, nil
}
+func (c *Client) dialTLS(network, addr string) (net.Conn, error) {
+ return c.dialTLSContext(context.Background(), network, addr)
+}
+
// splitHostPort is similar to net.SplitHostPort,
// but rather than return error if there isn't a ':port',
// return an empty string for the port.
diff --git a/vendor/github.com/vmware/govmomi/vim25/types/helpers.go b/vendor/github.com/vmware/govmomi/vim25/types/helpers.go
index 67d9793f..70360eb4 100644
--- a/vendor/github.com/vmware/govmomi/vim25/types/helpers.go
+++ b/vendor/github.com/vmware/govmomi/vim25/types/helpers.go
@@ -157,6 +157,18 @@ func (ci VirtualMachineConfigInfo) ToConfigSpec() VirtualMachineConfigSpec {
SevEnabled: ci.SevEnabled,
PmemFailoverEnabled: ci.PmemFailoverEnabled,
Pmem: ci.Pmem,
+ NpivWorldWideNameOp: ci.NpivWorldWideNameType,
+ RebootPowerOff: ci.RebootPowerOff,
+ ScheduledHardwareUpgradeInfo: ci.ScheduledHardwareUpgradeInfo,
+ SgxInfo: ci.SgxInfo,
+ GuestMonitoringModeInfo: ci.GuestMonitoringModeInfo,
+ VmxStatsCollectionEnabled: ci.VmxStatsCollectionEnabled,
+ VmOpNotificationToAppEnabled: ci.VmOpNotificationToAppEnabled,
+ VmOpNotificationTimeout: ci.VmOpNotificationTimeout,
+ DeviceSwap: ci.DeviceSwap,
+ SimultaneousThreads: ci.Hardware.SimultaneousThreads,
+ DeviceGroups: ci.DeviceGroups,
+ MotherboardLayout: ci.Hardware.MotherboardLayout,
}
// Unassign the Files field if all of its fields are empty.
@@ -234,6 +246,66 @@ func (ci VirtualMachineConfigInfo) ToConfigSpec() VirtualMachineConfigSpec {
}
}
+ if ni := ci.NumaInfo; ni != nil {
+ cs.VirtualNuma = &VirtualMachineVirtualNuma{
+ CoresPerNumaNode: ni.CoresPerNumaNode,
+ ExposeVnumaOnCpuHotadd: ni.VnumaOnCpuHotaddExposed,
+ }
+ }
+
+ if civa, ok := ci.VAppConfig.(*VmConfigInfo); ok {
+ var csva VmConfigSpec
+
+ csva.Eula = civa.Eula
+ csva.InstallBootRequired = &civa.InstallBootRequired
+ csva.InstallBootStopDelay = civa.InstallBootStopDelay
+
+ ipAssignment := civa.IpAssignment
+ csva.IpAssignment = &ipAssignment
+
+ csva.OvfEnvironmentTransport = civa.OvfEnvironmentTransport
+ for i := range civa.OvfSection {
+ s := civa.OvfSection[i]
+ csva.OvfSection = append(
+ csva.OvfSection,
+ VAppOvfSectionSpec{
+ ArrayUpdateSpec: ArrayUpdateSpec{
+ Operation: ArrayUpdateOperationAdd,
+ },
+ Info: &s,
+ },
+ )
+ }
+
+ for i := range civa.Product {
+ p := civa.Product[i]
+ csva.Product = append(
+ csva.Product,
+ VAppProductSpec{
+ ArrayUpdateSpec: ArrayUpdateSpec{
+ Operation: ArrayUpdateOperationAdd,
+ },
+ Info: &p,
+ },
+ )
+ }
+
+ for i := range civa.Property {
+ p := civa.Property[i]
+ csva.Property = append(
+ csva.Property,
+ VAppPropertySpec{
+ ArrayUpdateSpec: ArrayUpdateSpec{
+ Operation: ArrayUpdateOperationAdd,
+ },
+ Info: &p,
+ },
+ )
+ }
+
+ cs.VAppConfig = &csva
+ }
+
return cs
}
diff --git a/vendor/github.com/vmware/govmomi/vim25/types/types.go b/vendor/github.com/vmware/govmomi/vim25/types/types.go
index 30a58792..f7ae195f 100644
--- a/vendor/github.com/vmware/govmomi/vim25/types/types.go
+++ b/vendor/github.com/vmware/govmomi/vim25/types/types.go
@@ -8313,6 +8313,18 @@ func init() {
t["ClusterAttemptedVmInfo"] = reflect.TypeOf((*ClusterAttemptedVmInfo)(nil)).Elem()
}
+type ClusterClusterInitialPlacementAction struct {
+ ClusterAction
+
+ TargetHost *ManagedObjectReference `xml:"targetHost,omitempty"`
+ Pool ManagedObjectReference `xml:"pool"`
+ ConfigSpec *VirtualMachineConfigSpec `xml:"configSpec,omitempty"`
+}
+
+func init() {
+ t["ClusterClusterInitialPlacementAction"] = reflect.TypeOf((*ClusterClusterInitialPlacementAction)(nil)).Elem()
+}
+
type ClusterComplianceCheckedEvent struct {
ClusterEvent
@@ -8835,18 +8847,6 @@ func init() {
t["ClusterDasVmConfigSpec"] = reflect.TypeOf((*ClusterDasVmConfigSpec)(nil)).Elem()
}
-type ClusterDasVmPreemptiblePairInfo struct {
- DynamicData
-
- Key int32 `xml:"key,omitempty"`
- MonitoredVm ManagedObjectReference `xml:"monitoredVm"`
- PreemptibleVm ManagedObjectReference `xml:"preemptibleVm"`
-}
-
-func init() {
- t["ClusterDasVmPreemptiblePairInfo"] = reflect.TypeOf((*ClusterDasVmPreemptiblePairInfo)(nil)).Elem()
-}
-
type ClusterDasVmSettings struct {
DynamicData
diff --git a/vendor/github.com/vmware/govmomi/vim25/types/unreleased.go b/vendor/github.com/vmware/govmomi/vim25/types/unreleased.go
index ee1c09f3..72bc1082 100644
--- a/vendor/github.com/vmware/govmomi/vim25/types/unreleased.go
+++ b/vendor/github.com/vmware/govmomi/vim25/types/unreleased.go
@@ -98,8 +98,10 @@ func init() {
type PlaceVmsXClusterSpec struct {
DynamicData
- ResourcePools []ManagedObjectReference `xml:"resourcePools,omitempty"`
- VmPlacementSpecs []PlaceVmsXClusterSpecVmPlacementSpec `xml:"vmPlacementSpecs,omitempty"`
+ ResourcePools []ManagedObjectReference `xml:"resourcePools,omitempty"`
+ VmPlacementSpecs []PlaceVmsXClusterSpecVmPlacementSpec `xml:"vmPlacementSpecs,omitempty"`
+ HostRecommRequired *bool `xml:"hostRecommRequired"`
+ DatastoreRecommRequired *bool `xml:"datastoreRecommRequired"`
}
func init() {
@@ -117,13 +119,3 @@ func init() {
}
const RecommendationReasonCodeXClusterPlacement = RecommendationReasonCode("xClusterPlacement")
-
-type ClusterClusterInitialPlacementAction struct {
- ClusterInitialPlacementAction
-
- ConfigSpec *VirtualMachineConfigSpec `xml:"configSpec,omitempty"`
-}
-
-func init() {
- t["ClusterClusterInitialPlacementAction"] = reflect.TypeOf((*ClusterClusterInitialPlacementAction)(nil)).Elem()
-}
diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go
index 291c9190..46a89eda 100644
--- a/vendor/golang.org/x/net/html/parse.go
+++ b/vendor/golang.org/x/net/html/parse.go
@@ -184,7 +184,7 @@ func (p *parser) clearStackToContext(s scope) {
}
}
-// parseGenericRawTextElements implements the generic raw text element parsing
+// parseGenericRawTextElement implements the generic raw text element parsing
// algorithm defined in 12.2.6.2.
// https://html.spec.whatwg.org/multipage/parsing.html#parsing-elements-that-contain-only-text
// TODO: Since both RAWTEXT and RCDATA states are treated as tokenizer's part
diff --git a/vendor/golang.org/x/net/html/token.go b/vendor/golang.org/x/net/html/token.go
index ae24a6fd..50f7c6aa 100644
--- a/vendor/golang.org/x/net/html/token.go
+++ b/vendor/golang.org/x/net/html/token.go
@@ -598,6 +598,11 @@ scriptDataDoubleEscapeEnd:
// readComment reads the next comment token starting with "")
return
+ } else if c == '-' {
+ dashCount = 1
+ beginning = false
+ continue
}
}
}
@@ -645,6 +649,35 @@ func (z *Tokenizer) readComment() {
}
}
+func (z *Tokenizer) calculateAbruptCommentDataEnd() int {
+ raw := z.Raw()
+ const prefixLen = len("