diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..97be6f5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.vscode +.DS_Store +hack/*_go_metadata_test_report.xml diff --git a/go.mod b/go.mod index 67fc212..ebe3bfc 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/linode/go-metadata -go 1.20 +go 1.21 require ( github.com/go-resty/resty/v2 v2.12.0 diff --git a/hack/run-e2e.yml b/hack/run-e2e.yml index 1925406..6856989 100644 --- a/hack/run-e2e.yml +++ b/hack/run-e2e.yml @@ -48,7 +48,7 @@ label: "{{ label_prefix }}-{{ runner_id }}" type: "{{ type }}" region: "{{ region }}" - image: linode/ubuntu23.10 + image: linode/ubuntu24.04 booted: true metadata: user_data: '{{ lookup("template", playbook_dir ~ "/harden.yaml.j2") }}' @@ -95,6 +95,12 @@ become: yes apt: name: golang,make + + - name: Install go-junit-report + args: + executable: /bin/bash + shell: | + go install github.com/jstemmer/go-junit-report/v2@14d61e6e75e3f3c74551d757ad936e8e88014464 - name: Copy the local project to the remote synchronize: @@ -116,6 +122,7 @@ args: executable: /bin/bash shell: | + export PATH="$HOME/go/bin:$PATH" && \ cd ~/go-metadata-{{ run_id }} && \ source .test.env && \ make e2e-local @@ -123,14 +130,19 @@ - name: Find report.xml file on remote server find: - paths: "~/go-metadata-{{ run_id }}" + paths: "~/go-metadata-{{ run_id }}/test/integration" patterns: "*_go_metadata_test_report.xml" file_type: file register: report_files + - name: Extract filename from the found files + set_fact: + filename: "{{ report_files.files | first | default({}) }}" + when: report_files.files | length > 0 + - name: Copy report.xml to local folder directory fetch: - src: "{{ report_files.files | first | default({}).path }}" + src: "{{ filename.path }}" dest: "./" flat: yes remote_src: yes diff --git a/test/integration/go.mod b/test/integration/go.mod index 05eade6..2598258 100644 --- a/test/integration/go.mod +++ b/test/integration/go.mod @@ -3,7 +3,7 @@ module github.com/linode/go-metadata/test/integration -go 1.20 +go 1.21 require ( github.com/jarcoal/httpmock v1.3.1 diff --git a/test/integration/go.sum b/test/integration/go.sum index fce2487..aa665c0 100644 --- a/test/integration/go.sum +++ b/test/integration/go.sum @@ -3,11 +3,13 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/go-resty/resty/v2 v2.12.0 h1:rsVL8P90LFvkUYq/V5BTVe203WfRIU4gvcf+yfzJzGA= github.com/go-resty/resty/v2 v2.12.0/go.mod h1:o0yGPrkS3lOe1+eFajk6kBW8ScXzwU3hD69/gt2yB/0= 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/jarcoal/httpmock v1.3.1 h1:iUx3whfZWVf3jT01hQTO/Eo5sAYtB2/rqaUuOtpInww= github.com/jarcoal/httpmock v1.3.1/go.mod h1:3yb8rc4BI7TCBhFY8ng0gjuLKJNquuDNiPaZjnENuYg= github.com/linode/linodego v1.33.0 h1:cX2FYry7r6CA1ujBMsdqiM4VhvIQtnWsOuVblzfBhCw= github.com/linode/linodego v1.33.0/go.mod h1:dSJJgIwqZCF5wnpuC6w5cyIbRtcexAm7uVvuJopGB40= github.com/maxatome/go-testdeep v1.12.0 h1:Ql7Go8Tg0C1D/uMMX59LAoYK7LffeJQ6X2T04nTH68g= +github.com/maxatome/go-testdeep v1.12.0/go.mod h1:lPZc/HAcJMP92l7yI6TRz1aZN5URwUBUAfUNvrclaNM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= @@ -29,6 +31,7 @@ golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/oauth2 v0.19.0 h1:9+E/EZBCbTLNrbN35fHv/a/d/mOBatymz1zbtQrXpIg= +golang.org/x/oauth2 v0.19.0/go.mod h1:vYi7skDa1x015PmRRYZ7+s1cWyPgrPiSYRe4rnsexc8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=