From 8e2b8d65e8cb6290f025b466806e3fd78a016f81 Mon Sep 17 00:00:00 2001 From: Ivan Krutov Date: Mon, 22 Jan 2024 11:10:25 +0300 Subject: [PATCH 1/3] Bump Golang to 1.21.6 --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e9994ad..78c4782 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v3 with: - go-version: ~1.21.5 + go-version: ~1.21.6 - uses: actions/cache@v3 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cedb6fd..96e523a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v3 with: - go-version: ~1.21.5 + go-version: ~1.21.6 - uses: actions/cache@v3 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b1ccb4d..4a813b6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v3 with: - go-version: ~1.21.5 + go-version: ~1.21.6 - uses: actions/cache@v3 with: From 420f62b105cd0a24b595e79f8c33259d82693a05 Mon Sep 17 00:00:00 2001 From: Ivan Krutov Date: Mon, 22 Jan 2024 11:52:20 +0300 Subject: [PATCH 2/3] Updated dependencies to support Docker API 1.44 (fixes #347) --- go.mod | 36 ++++-- go.sum | 101 ++++++++++++---- selenoid/base_test.go | 10 +- selenoid/docker.go | 2 +- selenoid/docker_test.go | 230 ++++++++++++++++++------------------- selenoid/drivers_test.go | 62 +++++----- selenoid/lifecycle_test.go | 38 +++--- 7 files changed, 273 insertions(+), 206 deletions(-) diff --git a/go.mod b/go.mod index 37804a7..e812cef 100644 --- a/go.mod +++ b/go.mod @@ -1,14 +1,13 @@ module github.com/aerokube/cm -go 1.20 +go 1.21 require ( - github.com/Masterminds/semver/v3 v3.0.1 - github.com/aandryashin/matchers v0.0.0-20161126170413-435295ea180e - github.com/aerokube/selenoid v0.0.0-20220701113004-fbf82d85faee + github.com/Masterminds/semver/v3 v3.2.1 + github.com/aerokube/selenoid v0.0.0-20240109083731-079fe2dfad4f github.com/docker/cli v23.0.1+incompatible - github.com/docker/docker v24.0.7+incompatible - github.com/docker/go-connections v0.4.0 + github.com/docker/docker v25.0.0+incompatible + github.com/docker/go-connections v0.5.0 github.com/docker/go-units v0.5.0 github.com/fatih/color v1.14.1 github.com/fvbommel/sortorder v1.0.2 @@ -16,20 +15,27 @@ require ( github.com/heroku/docker-registry-client v0.0.0-20211012143308-9463674c8930 github.com/mattn/go-colorable v0.1.13 github.com/mitchellh/go-ps v1.0.0 - github.com/spf13/cobra v1.6.1 + github.com/spf13/cobra v1.8.0 + github.com/stretchr/testify v1.8.4 gopkg.in/cheggaaa/pb.v1 v1.0.28 ) require ( github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/containerd/log v0.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/distribution/reference v0.5.0 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker-credential-helpers v0.6.0 // indirect github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135 // indirect github.com/imdario/mergo v0.3.13 // indirect - github.com/inconshreveable/mousetrap v1.0.1 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/go-runewidth v0.0.2 // indirect github.com/moby/term v0.5.0 // indirect @@ -37,13 +43,19 @@ require ( github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.0.2 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/sirupsen/logrus v1.9.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/testify v1.8.3 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect + go.opentelemetry.io/otel v1.22.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/sdk v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect golang.org/x/mod v0.10.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.9.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.4.0 // indirect ) diff --git a/go.sum b/go.sum index 61c70e0..5d52144 100644 --- a/go.sum +++ b/go.sum @@ -1,31 +1,39 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Masterminds/semver/v3 v3.0.1 h1:2kKm5lb7dKVrt5TYUiAavE6oFc1cFT0057UVGT+JqLk= -github.com/Masterminds/semver/v3 v3.0.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= +github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OpenPeeDeeP/depguard v1.0.0/go.mod h1:7/4sitnI9YlQgTLLk734QlzXT8DuHVnAyztLplQjk+o= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/aandryashin/matchers v0.0.0-20161126170413-435295ea180e h1:ogUKYFNcdYUIBSLibE4+EjbTJazoHr5JsWWx21Lpn8c= -github.com/aandryashin/matchers v0.0.0-20161126170413-435295ea180e/go.mod h1:cbmYNkm9xeQlNoWEPtOUcvNok2gSD7ErMnYkRW+eHi8= -github.com/aerokube/selenoid v0.0.0-20220701113004-fbf82d85faee h1:hz1rnmZ46MMetzyNsawSn53y6g9kPj6b66zdvNA52No= -github.com/aerokube/selenoid v0.0.0-20220701113004-fbf82d85faee/go.mod h1:/SwIWtv/qzl0pu4KtDjFv8AiOFI6cSYpeC8M9NVZYEg= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/aerokube/ggr v0.0.0-20221124163939-c041f40a7e45/go.mod h1:ihsnG0Nf22lmjMKqK43xP2Iom8jnnD0oz9PkeWcRhNY= +github.com/aerokube/selenoid v0.0.0-20240109083731-079fe2dfad4f h1:mux+7hc0wnoNEBQjs1NA0BcghJFkDyYFdnb0D1vp4kg= +github.com/aerokube/selenoid v0.0.0-20240109083731-079fe2dfad4f/go.mod h1:hfoEb4dPF4hZh1e6EQm5eJmnVJtf0J3odWK8T8f93Lo= +github.com/aerokube/util v1.0.1/go.mod h1:rCvfLQKS1FYa4Jj1S7XTZF63jdPkld82FrcR0V2MRc0= +github.com/aws/aws-sdk-go v1.44.197/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= +github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= +github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/docker/cli v23.0.1+incompatible h1:LRyWITpGzl2C9e9uGxzisptnxAn1zfZKXy13Ul2Q5oM= github.com/docker/cli v23.0.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v0.0.0-20171011171712-7484e51bf6af/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= -github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v25.0.0+incompatible h1:g9b6wZTblhMgzOT2tspESstfw6ySZ9kdm94BLDKaZac= +github.com/docker/docker v25.0.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.6.0 h1:5bhDRLn1roGiNjz8IezRngHxMfoeaXGyr0BeMHq4rD8= github.com/docker/docker-credential-helpers v0.6.0/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y= -github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= +github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 h1:UhxFibDNY/bfvqU5CAUmr9zpesgbU6SWc8/B4mflAE4= @@ -33,11 +41,18 @@ github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7/go.mod h1:cyGadeNE github.com/fatih/color v1.6.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fvbommel/sortorder v1.0.2 h1:mV4o8B2hKboCdkJm+a7uX/SIpZob4JzUpc5GGnM45eo= github.com/fvbommel/sortorder v1.0.2/go.mod h1:uk88iVf1ovNn1iLfgUVU2F9o5eO30ui720w+kxuqRs0= github.com/go-critic/go-critic v0.3.5-0.20190526074819-1df300866540/go.mod h1:+sE8vrLDS2M0pZkBk0wy6+nLdKexVDrl/jBqQOTDThA= github.com/go-lintpack/lintpack v0.5.2/go.mod h1:NwZuYi2nUHho8XEIZ6SIxihrnPoqBTDqfpXvXAN0sXM= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4= github.com/go-toolsmith/astcopy v1.0.0/go.mod h1:vrgyG+5Bxrnz4MZWPF+pI4R8h3qKRjjyvV/DSez4WVQ= @@ -58,6 +73,8 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/mock v1.0.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6/go.mod h1:DbHgvLiFKX1Sh2T1w8Q/h4NAI8MHIpzCdnBUDTXU3I0= @@ -76,15 +93,20 @@ github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21/go.mod h1:tf5+bz github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0/go.mod h1:qOQCunEYvmd/TLamH+7LlVccLvUH5kZNhbCgTHoBbp4= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135 h1:zLTLjkaOFEFIOxY5BWLFLwh+cL8vOBW4XJ2aqLE/Tf0= github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w= github.com/heroku/docker-registry-client v0.0.0-20211012143308-9463674c8930 h1:mNL9ktJqBuzPTV/QP/fKd4y1uOFvfiv6zhe0G7lg9OA= github.com/heroku/docker-registry-client v0.0.0-20211012143308-9463674c8930/go.mod h1:Yho0S7KhsnHQRCC5lDraYF1SsLMeWtf/tKdufKu3TJA= @@ -92,8 +114,9 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= -github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v0.0.0-20161130080628-0de1eaf82fa3/go.mod h1:jxZFDH7ILpTPQTk+E2s+z4CUas9lVNjIuKR4c5/zKgM= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -102,10 +125,14 @@ github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0 github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= +github.com/mafredri/cdp v0.33.0/go.mod h1:Dbsh7eY/zhQlsddEDWzZGOztv9Jf2gzKq47M7a2P3C4= github.com/magiconair/properties v1.7.6/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= @@ -154,14 +181,14 @@ github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxr github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= github.com/sirupsen/logrus v1.0.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= -github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sourcegraph/go-diff v0.5.1/go.mod h1:j2dHj3m8aZgQO8lMTcTnBcXkRRRqi34cd2MNlA9u1mE= github.com/spf13/afero v1.1.0/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.2.0/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg= github.com/spf13/cobra v0.0.2/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= -github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/jwalterweatherman v0.0.0-20180109140146-7c0cea34c8ec/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -169,11 +196,12 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.0.2/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/timakin/bodyclose v0.0.0-20190721030226-87058b9bfcec/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= github.com/ultraware/funlen v0.0.1/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= @@ -182,6 +210,23 @@ github.com/valyala/quicktemplate v1.1.1/go.mod h1:EH+4AkTd43SvgIbQHYu59/cJyxDoOV github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= +go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= +go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 h1:9M3+rhx7kZCIQQhQRYaZCdNu1V73tm4TvXs2ntl98C4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0/go.mod h1:noq80iT8rrHP1SfybmPiRGc9dc5M8RPmGvtwo7Oo7tc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0 h1:FyjCyI9jVEfqhUh2MoSkmolPjfh5fp2hnV0b0irxH4Q= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0/go.mod h1:hYwym2nDEeZfG/motx0p7L7J1N1vyzIThemQsb4g2qY= +go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= +go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= +go.opentelemetry.io/otel/sdk v1.22.0 h1:6coWHw9xw7EfClIC/+O31R8IY3/+EiRFHevmHafB2Gw= +go.opentelemetry.io/otel/sdk v1.22.0/go.mod h1:iu7luyVGYovrRpe2fmj3CVKouQNdTOkxtLzPvPz1DOc= +go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= +go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= +go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= +go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -205,6 +250,7 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20171026204733-164713f0dfce/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -216,11 +262,13 @@ golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.0.0-20170915090833-1cbadb444a80/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 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.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20170915040203-e531a2a1c15f/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -243,8 +291,17 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T 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= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1:W18sezcAYs+3tDZX4F80yctqa12jcP1PUS2gQu1zTPU= +google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= +google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= +google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.28 h1:n1tBJnnK2r7g9OW2btFH91V92STTUevLXYFb8gy9EMk= gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= diff --git a/selenoid/base_test.go b/selenoid/base_test.go index 3809f35..efd80c0 100644 --- a/selenoid/base_test.go +++ b/selenoid/base_test.go @@ -1,16 +1,16 @@ package selenoid import ( - . "github.com/aandryashin/matchers" + assert "github.com/stretchr/testify/require" "path/filepath" "testing" ) func TestGetConfigDir(t *testing.T) { selenoidConfigDir := GetSelenoidConfigDir() - AssertThat(t, selenoidConfigDir, Not{""}) - AssertThat(t, filepath.IsAbs(selenoidConfigDir), Is{true}) + assert.NotEmpty(t, selenoidConfigDir) + assert.True(t, filepath.IsAbs(selenoidConfigDir)) selenoidUIConfigDir := GetSelenoidUIConfigDir() - AssertThat(t, selenoidUIConfigDir, Not{""}) - AssertThat(t, filepath.IsAbs(selenoidUIConfigDir), Is{true}) + assert.NotEmpty(t, selenoidUIConfigDir) + assert.True(t, filepath.IsAbs(selenoidUIConfigDir)) } diff --git a/selenoid/docker.go b/selenoid/docker.go index acc5fb1..7fdae3c 100644 --- a/selenoid/docker.go +++ b/selenoid/docker.go @@ -134,7 +134,7 @@ func createCompatibleDockerClient(onVersionSpecified, onVersionDetermined, onUsi onVersionSpecified(dockerApiVersionEnv) } else { maxMajorVersion, maxMinorVersion := parseVersion(api.DefaultVersion) - minMajorVersion, minMinorVersion := parseVersion(api.MinVersion) + minMajorVersion, minMinorVersion := parseVersion("1.12") for majorVersion := maxMajorVersion; majorVersion >= minMajorVersion; majorVersion-- { for minorVersion := maxMinorVersion; minorVersion >= minMinorVersion; minorVersion-- { apiVersion := fmt.Sprintf("%d.%d", majorVersion, minorVersion) diff --git a/selenoid/docker_test.go b/selenoid/docker_test.go index e4cfdd5..b181022 100644 --- a/selenoid/docker_test.go +++ b/selenoid/docker_test.go @@ -3,9 +3,9 @@ package selenoid import ( "encoding/json" "fmt" - . "github.com/aandryashin/matchers" "github.com/aerokube/selenoid/config" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/image" + assert "github.com/stretchr/testify/require" "net/http" "net/http/httptest" "os" @@ -65,42 +65,42 @@ func mux() http.Handler { mux.HandleFunc("/v2/aerokube/selenoid/tags/list", http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Type", "application/json") - fmt.Fprintln(w, `{"name":"selenoid", "tags": ["1.4.0", "1.4.1"]}`) + _, _ = fmt.Fprintln(w, `{"name":"selenoid", "tags": ["1.4.0", "1.4.1"]}`) }, )) mux.HandleFunc("/v2/aerokube/selenoid-ui/tags/list", http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Type", "application/json") - fmt.Fprintln(w, `{"name":"selenoid-ui", "tags": ["1.5.2"]}`) + _, _ = fmt.Fprintln(w, `{"name":"selenoid-ui", "tags": ["1.5.2"]}`) }, )) mux.HandleFunc("/v2/selenoid/firefox/tags/list", http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Type", "application/json") - fmt.Fprintln(w, `{"name":"firefox", "tags": ["46.0", "45.0", "7.0", "latest"]}`) + _, _ = fmt.Fprintln(w, `{"name":"firefox", "tags": ["46.0", "45.0", "7.0", "latest"]}`) }, )) mux.HandleFunc("/v2/selenoid/opera/tags/list", http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Type", "application/json") - fmt.Fprintln(w, `{"name":"opera", "tags": ["44.0", "latest"]}`) + _, _ = fmt.Fprintln(w, `{"name":"opera", "tags": ["44.0", "latest"]}`) }, )) mux.HandleFunc("/v2/selenoid/android/tags/list", http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Type", "application/json") - fmt.Fprintln(w, `{"name":"android", "tags": ["10.0"]}`) + _, _ = fmt.Fprintln(w, `{"name":"android", "tags": ["10.0"]}`) }, )) mux.HandleFunc("/v2/browsers/edge/tags/list", http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Type", "application/json") - fmt.Fprintln(w, `{"name":"edge", "tags": ["88.0"]}`) + _, _ = fmt.Fprintln(w, `{"name":"edge", "tags": ["88.0"]}`) }, )) @@ -124,14 +124,14 @@ func mux() http.Handler { } ` - w.Write([]byte(output)) + _, _ = w.Write([]byte(output)) }, )) mux.HandleFunc("/v1.29/images/create", http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) output := `{"id": "a86cd3433934", "status": "Downloading layer"}` - w.Write([]byte(output)) + _, _ = w.Write([]byte(output)) }, )) mux.HandleFunc("/v1.29/images/json", http.HandlerFunc( @@ -153,13 +153,13 @@ func mux() http.Handler { }] `, imageName) - w.Write([]byte(output)) + _, _ = w.Write([]byte(output)) }, )) mux.HandleFunc("/v1.29/networks/selenoid", http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) - w.Write([]byte(` + _, _ = w.Write([]byte(` [{ "Name": "selenoid", "Id": "39d591dabe313ed90b599e6d6515301e879c088b449a260cc02981bd25b52a6f", @@ -194,14 +194,14 @@ func mux() http.Handler { func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusCreated) output := `{"id": "39d591dabe31", "warnings": []}` - w.Write([]byte(output)) + _, _ = w.Write([]byte(output)) }, )) mux.HandleFunc("/v1.29/containers/create", http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusCreated) output := `{"id": "e90e34656806", "warnings": []}` - w.Write([]byte(output)) + _, _ = w.Write([]byte(output)) }, )) mux.HandleFunc("/v1.29/containers/e90e34656806/start", http.HandlerFunc( @@ -218,7 +218,7 @@ func mux() http.Handler { func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Type", "text/plain") w.WriteHeader(http.StatusOK) - w.Write([]byte("Some logs...\n")) + _, _ = w.Write([]byte("Some logs...\n")) }, )) mux.HandleFunc("/v1.29/containers/e90e34656806", http.HandlerFunc( @@ -260,14 +260,14 @@ func mux() http.Handler { }] `, containerName, imageName, port, port) - w.Write([]byte(output)) + _, _ = w.Write([]byte(output)) }, )) return mux } func TestImageWithTag(t *testing.T) { - AssertThat(t, imageWithTag("selenoid/firefox", "tag"), EqualTo{"selenoid/firefox:tag"}) + assert.Equal(t, imageWithTag("selenoid/firefox", "tag"), "selenoid/firefox:tag") } func TestFetchImageTags(t *testing.T) { @@ -276,13 +276,13 @@ func TestFetchImageTags(t *testing.T) { Quiet: false, } c, err := NewDockerConfigurator(&lcConfig) - AssertThat(t, err, Is{nil}) + assert.NoError(t, err) defer c.Close() tags := c.fetchImageTags("selenoid/firefox") - AssertThat(t, len(tags), EqualTo{3}) - AssertThat(t, tags[0], EqualTo{"46.0"}) - AssertThat(t, tags[1], EqualTo{"45.0"}) - AssertThat(t, tags[2], EqualTo{"7.0"}) + assert.Len(t, tags, 3) + assert.Equal(t, tags[0], "46.0") + assert.Equal(t, tags[1], "45.0") + assert.Equal(t, tags[2], "7.0") } func TestPullImages(t *testing.T) { @@ -291,12 +291,12 @@ func TestPullImages(t *testing.T) { Quiet: false, } c, err := NewDockerConfigurator(&lcConfig) - AssertThat(t, err, Is{nil}) + assert.NoError(t, err) defer c.Close() tags := c.pullImages("selenoid/firefox", []string{"46.0", "45.0"}) - AssertThat(t, len(tags), EqualTo{2}) - AssertThat(t, tags[0], EqualTo{"46.0"}) - AssertThat(t, tags[1], EqualTo{"45.0"}) + assert.Len(t, tags, 2) + assert.Equal(t, tags[0], "46.0") + assert.Equal(t, tags[1], "45.0") } func TestConfigureDocker(t *testing.T) { @@ -325,19 +325,19 @@ func testConfigure(t *testing.T, download bool) { BrowserEnv: testEnv, } c, err := NewDockerConfigurator(&lcConfig) - AssertThat(t, err, Is{nil}) + assert.NoError(t, err) defer c.Close() - AssertThat(t, c.IsConfigured(), Is{false}) + assert.False(t, c.IsConfigured()) cfgPointer, err := (*c).Configure() - AssertThat(t, err, Is{nil}) - AssertThat(t, cfgPointer, Is{Not{nil}}) + assert.NoError(t, err) + assert.NotNil(t, cfgPointer) cfg := *cfgPointer - AssertThat(t, len(cfg), EqualTo{4}) + assert.Len(t, cfg, 4) firefoxVersions, hasFirefoxKey := cfg["firefox"] - AssertThat(t, hasFirefoxKey, Is{true}) - AssertThat(t, firefoxVersions, Is{Not{nil}}) + assert.True(t, hasFirefoxKey, true) + assert.NotNil(t, firefoxVersions) tmpfsMap := make(map[string]string) tmpfsMap["/tmp"] = "size=512m" @@ -351,15 +351,15 @@ func testConfigure(t *testing.T, download bool) { ShmSize: 268435456, Env: []string{testEnv}, } - AssertThat(t, firefoxVersions, EqualTo{config.Versions{ + assert.Equal(t, firefoxVersions, config.Versions{ Default: "46.0", Versions: correctFFBrowsers, - }}) + }) operaVersions, hasOperaKey := cfg["opera"] - AssertThat(t, hasOperaKey, Is{true}) - AssertThat(t, operaVersions, Is{Not{nil}}) - AssertThat(t, operaVersions.Default, EqualTo{"44.0"}) + assert.True(t, hasOperaKey) + assert.NotNil(t, operaVersions) + assert.Equal(t, operaVersions.Default, "44.0") correctOperaBrowsers := make(map[string]*config.Browser) correctOperaBrowsers["44.0"] = &config.Browser{ @@ -370,14 +370,14 @@ func testConfigure(t *testing.T, download bool) { ShmSize: 268435456, Env: []string{testEnv}, } - AssertThat(t, operaVersions, EqualTo{config.Versions{ + assert.Equal(t, operaVersions, config.Versions{ Default: "44.0", Versions: correctOperaBrowsers, - }}) + }) androidVersions, hasAndroidKey := cfg["android"] - AssertThat(t, hasAndroidKey, Is{true}) - AssertThat(t, androidVersions, Is{Not{nil}}) + assert.True(t, hasAndroidKey, true) + assert.NotNil(t, androidVersions) correctAndroidBrowsers := make(map[string]*config.Browser) correctAndroidBrowsers["10.0"] = &config.Browser{ @@ -388,14 +388,14 @@ func testConfigure(t *testing.T, download bool) { ShmSize: 268435456, Env: []string{testEnv}, } - AssertThat(t, androidVersions, EqualTo{config.Versions{ + assert.Equal(t, androidVersions, config.Versions{ Default: "10.0", Versions: correctAndroidBrowsers, - }}) + }) edgeVersions, hasEdgeKey := cfg["MicrosoftEdge"] - AssertThat(t, hasEdgeKey, Is{true}) - AssertThat(t, edgeVersions, Is{Not{nil}}) + assert.True(t, hasEdgeKey) + assert.NotNil(t, edgeVersions) correctEdgeBrowsers := make(map[string]*config.Browser) correctEdgeBrowsers["88.0"] = &config.Browser{ @@ -406,10 +406,10 @@ func testConfigure(t *testing.T, download bool) { ShmSize: 268435456, Env: []string{testEnv}, } - AssertThat(t, edgeVersions, EqualTo{config.Versions{ + assert.Equal(t, edgeVersions, config.Versions{ Default: "88.0", Versions: correctEdgeBrowsers, - }}) + }) }) } @@ -430,7 +430,7 @@ func TestSyncWithConfig(t *testing.T) { initialCfgFile := filepath.Join(dir, "initial-browsers.json") data, _ := json.Marshal(initialCfg) - os.WriteFile(initialCfgFile, data, 0644) + _ = os.WriteFile(initialCfgFile, data, 0644) lcConfig := LifecycleConfig{ ConfigDir: dir, @@ -440,15 +440,15 @@ func TestSyncWithConfig(t *testing.T) { Quiet: false, } c, err := NewDockerConfigurator(&lcConfig) - AssertThat(t, err, Is{nil}) + assert.NoError(t, err) defer c.Close() - AssertThat(t, c.IsConfigured(), Is{false}) + assert.False(t, c.IsConfigured()) cfgPointer, err := (*c).Configure() - AssertThat(t, err, Is{nil}) - AssertThat(t, cfgPointer, Is{Not{nil}}) + assert.NoError(t, err) + assert.NotNil(t, cfgPointer) cfg := *cfgPointer - AssertThat(t, cfg, EqualTo{initialCfg}) + assert.Equal(t, cfg, initialCfg) }) } @@ -460,11 +460,11 @@ func TestStartStopContainer(t *testing.T) { Version: Latest, UserNS: "host", }) - AssertThat(t, err, Is{nil}) - AssertThat(t, c.IsRunning(), Is{true}) - AssertThat(t, c.Start(), Is{nil}) + assert.NoError(t, err) + assert.True(t, c.IsRunning()) + assert.NoError(t, c.Start()) c.Status() - AssertThat(t, c.Stop(), Is{nil}) + assert.NoError(t, c.Stop()) } func TestStartStopUIContainer(t *testing.T) { @@ -477,14 +477,14 @@ func TestStartStopUIContainer(t *testing.T) { RegistryUrl: mockDockerServer.URL, Port: SelenoidUIDefaultPort, }) - AssertThat(t, err, Is{nil}) + assert.NoError(t, err) setContainerName(selenoidUIContainerName) setImageName(selenoidUIImage) setPort(SelenoidUIDefaultPort) - AssertThat(t, c.IsUIRunning(), Is{true}) - AssertThat(t, c.StartUI(), Is{nil}) + assert.True(t, c.IsUIRunning()) + assert.NoError(t, c.StartUI()) c.UIStatus() - AssertThat(t, c.StopUI(), Is{nil}) + assert.NoError(t, c.StopUI()) } func TestDownload(t *testing.T) { @@ -493,12 +493,12 @@ func TestDownload(t *testing.T) { Quiet: true, Version: Latest, }) - AssertThat(t, err, Is{nil}) - AssertThat(t, c.IsDownloaded(), Is{true}) + assert.NoError(t, err) + assert.True(t, c.IsDownloaded()) ref, err := c.Download() - AssertThat(t, ref, Not{nil}) - AssertThat(t, err, Is{nil}) - AssertThat(t, c.PrintArgs(), Is{nil}) + assert.NoError(t, err) + assert.NotNil(t, ref) + assert.NoError(t, c.PrintArgs()) } func TestDownloadUI(t *testing.T) { @@ -511,12 +511,12 @@ func TestDownloadUI(t *testing.T) { Version: Latest, }) setImageName(selenoidUIImage) - AssertThat(t, err, Is{nil}) - AssertThat(t, c.IsUIDownloaded(), Is{true}) + assert.NoError(t, err) + assert.True(t, c.IsUIDownloaded()) ref, err := c.DownloadUI() - AssertThat(t, ref, Not{nil}) - AssertThat(t, err, Is{nil}) - AssertThat(t, c.PrintUIArgs(), Is{nil}) + assert.NoError(t, err) + assert.NotNil(t, ref) + assert.NoError(t, c.PrintUIArgs()) } func TestGetSelenoidImage(t *testing.T) { @@ -528,32 +528,32 @@ func TestGetSelenoidImage(t *testing.T) { Quiet: true, Version: Latest, }) - AssertThat(t, err, Is{nil}) - AssertThat(t, c.getSelenoidImage() == nil, Is{false}) + assert.NoError(t, err) + assert.NotNil(t, c.getSelenoidImage()) setImageName(selenoidUIImage) - AssertThat(t, c.getSelenoidImage() == nil, Is{true}) + assert.Nil(t, c.getSelenoidImage()) } func TestFindMatchingImage(t *testing.T) { var ( - selenoid141 = types.ImageSummary{ + selenoid141 = image.Summary{ ID: "1", RepoTags: []string{"aerokube/selenoid:1.4.1"}, Created: 100, } - selenoid143 = types.ImageSummary{ + selenoid143 = image.Summary{ ID: "3", RepoTags: []string{"aerokube/selenoid:1.4.3"}, Created: 300, } - selenoid120CustomRegistry = types.ImageSummary{ + selenoid120CustomRegistry = image.Summary{ ID: "4", RepoTags: []string{"my-registry.com:443/aerokube/selenoid:1.2.0"}, Created: 100, } ) - images := []types.ImageSummary{ + images := []image.Summary{ selenoid141, { ID: "2", @@ -564,81 +564,81 @@ func TestFindMatchingImage(t *testing.T) { selenoid120CustomRegistry, } - AssertThat(t, findMatchingImage(images, "unknown-image-name", Latest) == nil, Is{true}) - AssertThat(t, findMatchingImage(images, "aerokube/selenoid", "missing-version") == nil, Is{true}) + assert.Nil(t, findMatchingImage(images, "unknown-image-name", Latest)) + assert.Nil(t, findMatchingImage(images, "aerokube/selenoid", "missing-version")) foundSelenoid141 := findMatchingImage(images, "aerokube/selenoid", "1.4.1") - AssertThat(t, foundSelenoid141, Not{nil}) - AssertThat(t, *foundSelenoid141, EqualTo{selenoid141}) + assert.NotNil(t, foundSelenoid141) + assert.Equal(t, *foundSelenoid141, selenoid141) foundSelenoidEmpty := findMatchingImage(images, "aerokube/selenoid", "") - AssertThat(t, foundSelenoidEmpty, Not{nil}) - AssertThat(t, *foundSelenoidEmpty, EqualTo{selenoid143}) + assert.NotNil(t, foundSelenoidEmpty) + assert.Equal(t, *foundSelenoidEmpty, selenoid143) foundSelenoidLatest := findMatchingImage(images, "aerokube/selenoid", Latest) - AssertThat(t, foundSelenoidLatest, Not{nil}) - AssertThat(t, *foundSelenoidLatest, EqualTo{selenoid143}) + assert.NotNil(t, foundSelenoidLatest) + assert.Equal(t, *foundSelenoidLatest, selenoid143) foundSelenoidCustomRegistry := findMatchingImage(images, "my-registry.com:443/aerokube/selenoid", "1.2.0") - AssertThat(t, foundSelenoidCustomRegistry, Not{nil}) - AssertThat(t, *foundSelenoidCustomRegistry, EqualTo{selenoid120CustomRegistry}) + assert.NotNil(t, foundSelenoidCustomRegistry, nil) + assert.Equal(t, *foundSelenoidCustomRegistry, selenoid120CustomRegistry) foundSelenoidWithoutRegistry := findMatchingImage(images, "aerokube/selenoid", "1.2.0") - AssertThat(t, foundSelenoidWithoutRegistry, Not{nil}) - AssertThat(t, *foundSelenoidWithoutRegistry, EqualTo{selenoid120CustomRegistry}) + assert.NotNil(t, foundSelenoidWithoutRegistry, nil) + assert.Equal(t, *foundSelenoidWithoutRegistry, selenoid120CustomRegistry) } func TestIsVideoRecordingSupported(t *testing.T) { logger := Logger{} - AssertThat(t, isVideoRecordingSupported(logger, "wrong-version"), Is{false}) - AssertThat(t, isVideoRecordingSupported(logger, "1.3.9"), Is{false}) - AssertThat(t, isVideoRecordingSupported(logger, "1.4.0"), Is{true}) - AssertThat(t, isVideoRecordingSupported(logger, "1.4.1"), Is{true}) - AssertThat(t, isVideoRecordingSupported(logger, "1.5.0"), Is{true}) - AssertThat(t, isVideoRecordingSupported(logger, "latest"), Is{true}) + assert.False(t, isVideoRecordingSupported(logger, "wrong-version")) + assert.False(t, isVideoRecordingSupported(logger, "1.3.9")) + assert.True(t, isVideoRecordingSupported(logger, "1.4.0")) + assert.True(t, isVideoRecordingSupported(logger, "1.4.1")) + assert.True(t, isVideoRecordingSupported(logger, "1.5.0")) + assert.True(t, isVideoRecordingSupported(logger, "latest")) } func TestFilterOutLatest(t *testing.T) { tags := filterOutLatest([]string{"one", "latest", "latest-release", "two"}) - AssertThat(t, tags, EqualTo{[]string{"one", "two"}}) + assert.Equal(t, tags, []string{"one", "two"}) } func TestChooseVolumeConfigDir(t *testing.T) { dirWithoutVariable := chooseVolumeConfigDir("/some/dir", []string{"one", "two"}) - AssertThat(t, dirWithoutVariable, EqualTo{"/some/dir"}) + assert.Equal(t, dirWithoutVariable, "/some/dir") os.Setenv("OVERRIDE_HOME", "/test/dir") defer os.Unsetenv("OVERRIDE_HOME") dir := chooseVolumeConfigDir("/some/dir", []string{"one", "two"}) - AssertThat(t, dir, EqualTo{"/test/dir/one/two"}) + assert.Equal(t, dir, "/test/dir/one/two") } func TestPostProcessPath(t *testing.T) { - AssertThat(t, postProcessPath("C:\\Users\\admin"), EqualTo{"/c/Users/admin"}) - AssertThat(t, postProcessPath("C:\\C:\\Users\\admin"), EqualTo{"/c/C:/Users/admin"}) - AssertThat(t, postProcessPath("1"), EqualTo{"1"}) - AssertThat(t, postProcessPath(""), EqualTo{""}) + assert.Equal(t, postProcessPath("C:\\Users\\admin"), "/c/Users/admin") + assert.Equal(t, postProcessPath("C:\\C:\\Users\\admin"), "/c/C:/Users/admin") + assert.Equal(t, postProcessPath("1"), "1") + assert.Empty(t, postProcessPath("")) } func TestValidEnviron(t *testing.T) { - AssertThat(t, validateEnviron([]string{"=::=::"}), EqualTo{[]string{}}) - AssertThat(t, validateEnviron([]string{"HOMEDRIVE=C:", "DOCKER_HOST=192.168.0.1", "=::=::"}), EqualTo{[]string{"HOMEDRIVE=C:", "DOCKER_HOST=192.168.0.1"}}) + assert.Equal(t, validateEnviron([]string{"=::=::"}), []string{}) + assert.Equal(t, validateEnviron([]string{"HOMEDRIVE=C:", "DOCKER_HOST=192.168.0.1", "=::=::"}), []string{"HOMEDRIVE=C:", "DOCKER_HOST=192.168.0.1"}) } func TestParseRequestedBrowsers(t *testing.T) { output := parseRequestedBrowsers(&Logger{}, "firefox:>45.0,51.0;opera; android:7.1;firefox:<50.0") - AssertThat(t, len(output), EqualTo{3}) + assert.Len(t, output, 3) ff, ok := output["firefox"] - AssertThat(t, ok, Is{true}) - AssertThat(t, ff, Not{nil}) - AssertThat(t, len(ff), EqualTo{2}) + assert.True(t, ok) + assert.NotNil(t, ff) + assert.Len(t, ff, 2) opera, ok := output["opera"] - AssertThat(t, ok, Is{true}) - AssertThat(t, len(opera), EqualTo{0}) + assert.True(t, ok) + assert.Empty(t, opera) android, ok := output["android"] - AssertThat(t, ok, Is{true}) - AssertThat(t, android, Not{nil}) - AssertThat(t, len(android), EqualTo{1}) + assert.True(t, ok) + assert.NotNil(t, android) + assert.Len(t, android, 1) } diff --git a/selenoid/drivers_test.go b/selenoid/drivers_test.go index e142c45..9679388 100644 --- a/selenoid/drivers_test.go +++ b/selenoid/drivers_test.go @@ -3,9 +3,9 @@ package selenoid import ( "encoding/json" "fmt" - . "github.com/aandryashin/matchers" "github.com/aerokube/selenoid/config" "github.com/google/go-github/github" + assert "github.com/stretchr/testify/require" "net/http" "net/http/httptest" "net/url" @@ -126,13 +126,13 @@ func driversMux() http.Handler { func TestAllUrlsAreValid(t *testing.T) { dir, err := os.Getwd() - AssertThat(t, err, Is{nil}) + assert.NoError(t, err) data := readFile(t, path.Join(dir, "..", "browsers.json")) var browsers Browsers err = json.Unmarshal(data, &browsers) - AssertThat(t, err, Is{nil}) + assert.NoError(t, err) //Loops are ugly but we need to check all urls in one test... for _, browser := range browsers { @@ -178,13 +178,13 @@ func TestConfigureDrivers(t *testing.T) { BrowserEnv: testEnv, } configurator := NewDriversConfigurator(&lcConfig) - AssertThat(t, configurator.IsConfigured(), Is{false}) + assert.False(t, configurator.IsConfigured()) cfgPointer, err := (*configurator).Configure() - AssertThat(t, err, Is{nil}) - AssertThat(t, cfgPointer, Is{Not{nil}}) + assert.NoError(t, err) + assert.NotNil(t, cfgPointer) cfg := *cfgPointer - AssertThat(t, len(cfg), EqualTo{3}) + assert.Len(t, cfg, 3) unpackedFirstFile := path.Join(dir, "zip-testfile") unpackedSecondFile := path.Join(dir, "gzip-testfile") @@ -238,8 +238,8 @@ func TestConfigureDrivers(t *testing.T) { func TestUnzip(t *testing.T) { data := readFile(t, "testfile.zip") - AssertThat(t, isZipFile(data), Is{true}) - AssertThat(t, isTarGzFile(data), Is{false}) + assert.True(t, isZipFile(data)) + assert.False(t, isTarGzFile(data)) testUnpack(t, data, "zip-testfile", func(data []byte, filePath string, outputDir string) (string, error) { return unzip(data, filePath, outputDir) }, "zip\n") @@ -247,8 +247,8 @@ func TestUnzip(t *testing.T) { func TestUntar(t *testing.T) { data := readFile(t, "testfile.tar.gz") - AssertThat(t, isTarGzFile(data), Is{true}) - AssertThat(t, isZipFile(data), Is{false}) + assert.True(t, isTarGzFile(data)) + assert.False(t, isZipFile(data)) testUnpack(t, data, "gzip-testfile", func(data []byte, filePath string, outputDir string) (string, error) { return untar(data, filePath, outputDir) }, "gzip\n") @@ -288,7 +288,7 @@ func TestDownloadFile(t *testing.T) { if err != nil { t.Fatalf("failed to download file: %v\n", err) } - AssertThat(t, string(data), EqualTo{"test-data"}) + assert.Equal(t, string(data), "test-data") } func mockServerUrl(mockServer *httptest.Server, relativeUrl string) string { @@ -345,16 +345,16 @@ func testDownloadRelease(t *testing.T, desiredVersion string, expectedFileConten Version: desiredVersion, } configurator := NewDriversConfigurator(&lcConfig) - AssertThat(t, configurator.IsDownloaded(), Is{false}) + assert.False(t, configurator.IsDownloaded()) outputPath, err := configurator.Download() - AssertThat(t, err, Is{nil}) - AssertThat(t, outputPath, Is{Not{nil}}) + assert.NoError(t, err) + assert.NotNil(t, outputPath) checkContentsEqual(t, outputPath, expectedFileContents) uiOutputPath, err := configurator.DownloadUI() - AssertThat(t, err, Is{nil}) - AssertThat(t, uiOutputPath, Is{Not{nil}}) + assert.NoError(t, err) + assert.NotNil(t, uiOutputPath) checkContentsEqual(t, uiOutputPath, expectedFileContents) }) @@ -365,8 +365,8 @@ func checkContentsEqual(t *testing.T, outputPath string, expectedFileContents st t.Fatalf("release was not downloaded to %s: file does not exist\n", outputPath) } data, err := os.ReadFile(outputPath) - AssertThat(t, err, Is{nil}) - AssertThat(t, string(data), EqualTo{expectedFileContents}) + assert.NoError(t, err) + assert.Equal(t, string(data), expectedFileContents) } @@ -387,7 +387,7 @@ func downloadShouldFail(t *testing.T, fn func(string) *DriversConfigurator) { withTmpDir(t, "something", func(t *testing.T, dir string) { configurator := fn(dir) _, err := configurator.Download() - AssertThat(t, err, Is{Not{nil}}) + assert.Error(t, err) }) } @@ -433,18 +433,18 @@ func TestStartStopProcess(t *testing.T) { Port: SelenoidDefaultPort, } configurator := NewDriversConfigurator(&lcConfig) - AssertThat(t, configurator.IsRunning(), Is{true}) //This is probably true because test binary has name selenoid.test; no fake process is launched - AssertThat(t, configurator.Start(), Is{nil}) + assert.True(t, configurator.IsRunning()) //This is probably true because test binary has name selenoid.test; no fake process is launched + assert.NoError(t, configurator.Start()) configurator.Status() - AssertThat(t, configurator.Stop(), Is{nil}) - AssertThat(t, configurator.PrintArgs(), Is{nil}) + assert.NoError(t, configurator.Stop()) + assert.NoError(t, configurator.PrintArgs()) lcConfig.Port = SelenoidUIDefaultPort - AssertThat(t, configurator.IsUIRunning(), Is{false}) - AssertThat(t, configurator.StartUI(), Is{nil}) + assert.False(t, configurator.IsUIRunning()) + assert.NoError(t, configurator.StartUI()) configurator.UIStatus() - AssertThat(t, configurator.StopUI(), Is{nil}) - AssertThat(t, configurator.PrintUIArgs(), Is{nil}) + assert.NoError(t, configurator.StopUI()) + assert.NoError(t, configurator.PrintUIArgs()) }) } @@ -458,11 +458,11 @@ func fakeExecCommand(command string, args ...string) *exec.Cmd { } func TestPrepareCommand(t *testing.T) { - AssertThat( + assert.Equal( t, prepareCommand("%s --some-arg", "/path/with spaces"), - EqualTo{[]string{ + []string{ "/path/with spaces", "--some-arg", - }}, + }, ) } diff --git a/selenoid/lifecycle_test.go b/selenoid/lifecycle_test.go index 8db95b8..fa86bf9 100644 --- a/selenoid/lifecycle_test.go +++ b/selenoid/lifecycle_test.go @@ -1,7 +1,7 @@ package selenoid import ( - . "github.com/aandryashin/matchers" + assert "github.com/stretchr/testify/require" "net/http" "net/http/httptest" "net/url" @@ -85,21 +85,19 @@ func (ms *MockStrategy) Close() error { } func TestDockerUnavailable(t *testing.T) { - AssertThat(t, isDockerAvailable(), Is{false}) + assert.False(t, isDockerAvailable()) } func TestDockerAvailable(t *testing.T) { mux := http.NewServeMux() - mux.HandleFunc("/_ping", http.HandlerFunc( - func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - }, - )) + mux.HandleFunc("/_ping", func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + }) mockDockerServer := httptest.NewServer(mux) - os.Setenv("DOCKER_HOST", "tcp://"+hostPort(mockDockerServer.URL)) + _ = os.Setenv("DOCKER_HOST", "tcp://"+hostPort(mockDockerServer.URL)) defer os.Unsetenv("DOCKER_HOST") - AssertThat(t, isDockerAvailable(), Is{true}) + assert.True(t, isDockerAvailable()) } func hostPort(input string) string { @@ -115,14 +113,14 @@ func TestLifecycle(t *testing.T) { lc := createTestLifecycle(strategy) defer lc.Close() lc.Status() - AssertThat(t, lc.Download(), Is{nil}) - AssertThat(t, lc.PrintArgs(), Is{nil}) - AssertThat(t, lc.Configure(), Is{nil}) - AssertThat(t, lc.Start(), Is{nil}) + assert.NoError(t, lc.Download()) + assert.NoError(t, lc.PrintArgs()) + assert.NoError(t, lc.Configure()) + assert.NoError(t, lc.Start()) strategy.isRunning = true - AssertThat(t, lc.Start(), Is{nil}) + assert.NoError(t, lc.Start()) strategy.isRunning = false - AssertThat(t, lc.Stop(), Is{nil}) + assert.NoError(t, lc.Stop()) } func createTestLifecycle(strategy MockStrategy) Lifecycle { @@ -144,11 +142,11 @@ func TestUILifecycle(t *testing.T) { lc := createTestLifecycle(strategy) defer lc.Close() lc.UIStatus() - AssertThat(t, lc.DownloadUI(), Is{nil}) - AssertThat(t, lc.PrintUIArgs(), Is{nil}) - AssertThat(t, lc.StartUI(), Is{nil}) + assert.NoError(t, lc.DownloadUI()) + assert.NoError(t, lc.PrintUIArgs()) + assert.NoError(t, lc.StartUI()) strategy.isRunning = true - AssertThat(t, lc.StartUI(), Is{nil}) + assert.NoError(t, lc.StartUI()) strategy.isRunning = false - AssertThat(t, lc.StopUI(), Is{nil}) + assert.NoError(t, lc.StopUI()) } From 2f4214a8f9987897b47014f89ccd685a209f2831 Mon Sep 17 00:00:00 2001 From: Ivan Krutov Date: Mon, 22 Jan 2024 11:55:53 +0300 Subject: [PATCH 3/3] Fixed Operadriver URL --- browsers.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/browsers.json b/browsers.json index 76639ec..99b439d 100644 --- a/browsers.json +++ b/browsers.json @@ -64,23 +64,23 @@ "files": { "linux": { "amd64": { - "url": "https://github.com/operasoftware/operachromiumdriver/releases/download/v.106.0.5249.119 /operadriver_linux64.zip", + "url": "https://github.com/operasoftware/operachromiumdriver/releases/download/v.106.0.5249.119/operadriver_linux64.zip", "filename": "operadriver_linux64/operadriver" } }, "darwin": { "amd64": { - "url": "https://github.com/operasoftware/operachromiumdriver/releases/download/v.106.0.5249.119 /operadriver_mac64.zip", + "url": "https://github.com/operasoftware/operachromiumdriver/releases/download/v.106.0.5249.119/operadriver_mac64.zip", "filename": "operadriver_mac64/operadriver" } }, "windows": { "386": { - "url": "https://github.com/operasoftware/operachromiumdriver/releases/download/v.106.0.5249.119 /operadriver_win32.zip", + "url": "https://github.com/operasoftware/operachromiumdriver/releases/download/v.106.0.5249.119/operadriver_win32.zip", "filename": "operadriver_win32/operadriver.exe" }, "amd64": { - "url": "https://github.com/operasoftware/operachromiumdriver/releases/download/v.106.0.5249.119 /operadriver_win64.zip", + "url": "https://github.com/operasoftware/operachromiumdriver/releases/download/v.106.0.5249.119/operadriver_win64.zip", "filename": "operadriver_win64/operadriver.exe" } }