From a2bc990ef1363d080f02662b197f38c6a4285724 Mon Sep 17 00:00:00 2001 From: Pranshu Srivastava Date: Sat, 23 Nov 2024 14:16:31 +0530 Subject: [PATCH] chore: support e2e tests on netbsd Signed-off-by: Pranshu Srivastava --- .github/workflows/bsd.yml | 52 +++++----- collector/fixtures/e2e-output-netbsd.txt | 117 +++++++++++++++++++++++ 2 files changed, 143 insertions(+), 26 deletions(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index f2ba187b7d..ba9b0e268b 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -14,7 +14,7 @@ permissions: env: GO_VERSION_FREEBSD: "123" GO_VERSION_OPENBSD: "1.23.1" - GNU_GREP_VERSION: "3.11" + GO_VERSION_NETBSD: "123" GNU_TAR_VERSION: "1.35" jobs: @@ -29,15 +29,15 @@ jobs: uses: vmactions/freebsd-vm@v1 if: false # this already passes, so skip to test other BSDs faster with: - envs: 'GO_VERSION_FREEBSD GNU_GREP_VERSION GNU_TAR_VERSION' + envs: 'GO_VERSION_FREEBSD GNU_TAR_VERSION' usesh: true prepare: | pkg update -f - pkg install -y bash curl gtar-${GNU_TAR_VERSION}p0-static git gmake gsed ggrep go-${GO_VERSION_FREEBSD} python + pkg install -y bash curl gtar-${GNU_TAR_VERSION}p0-static git gmake gsed ggrep go${GO_VERSION_FREEBSD} python run: | set -eux mkdir bin - ln -s $(which go-${GO_VERSION_FREEBSD}) bin/go + ln -s $(which go${GO_VERSION_FREEBSD}) bin/go ln -s $(which ggrep) bin/grep ln -s $(which gmake) bin/make ln -s $(which gsed) bin/sed @@ -58,8 +58,9 @@ jobs: - name: Run end-to-end tests on OpenBSD uses: vmactions/openbsd-vm@v1 + if: false with: - envs: 'GO_VERSION_OPENBSD GNU_GREP_VERSION GNU_TAR_VERSION' + envs: 'GO_VERSION_OPENBSD GNU_TAR_VERSION' usesh: true prepare: | pkg_add -u @@ -67,9 +68,9 @@ jobs: run: | set -eux mkdir bin - ln -s $(which gsed) bin/sed ln -s $(which ggrep) bin/grep ln -s $(which gmake) bin/make + ln -s $(which gsed) bin/sed ln -s $(which gtar) bin/tar export PATH=$(pwd)/bin:$PATH @@ -86,41 +87,40 @@ jobs: - name: Run end-to-end tests on NetBSD uses: vmactions/netbsd-vm@v1 with: - envs: 'GO_VERSION' + envs: 'GO_VERSION_NETBSD GNU_TAR_VERSION' usesh: true prepare: | - /usr/sbin/pkg_add update -f - /usr/sbin/pkg_add install -y bash curl git gmake gsed gnugrep go${GO_VERSION} python - run: | + /usr/sbin/pkg_add -u + /usr/sbin/pkg_add curl gtar-base-${GNU_TAR_VERSION} git gmake gsed grep go${GO_VERSION_NETBSD} python312 + run: | set -eux mkdir bin - ln -s $(which go${GO_VERSION}) bin/go - ln -s $(which gsed) bin/sed - ln -s $(which gnugrep) bin/grep + ln -s $(which go${GO_VERSION_NETBSD}) bin/go + ln -s $(which ggrep) bin/grep ln -s $(which gmake) bin/make - export PATH=$PATH:$(pwd)/golang-bin + ln -s $(which gsed) bin/sed + ln -s $(which gtar) bin/tar + export PATH=$(pwd)/bin:$PATH echo "::group::Print environment information" - freebsd-version - uname -a echo "GOOS: $(go env GOOS)" echo "GOARCH: $(go env GOARCH)" echo "::endgroup::" echo "::group::Run End-to-End Tests" git config --global --add safe.directory $(pwd) - gmake test-e2e + make test-e2e echo "::endgroup::" - - name: Run end-to-end tests on Solaris - uses: vmactions/solaris-vm@v1 + - name: Run end-to-end tests on DragonFly + uses: vmactions/dragonflybsd-vm@v1 with: envs: 'GO_VERSION' usesh: true prepare: | - pkgutil update -f - pkgutil install -y bash curl git gmake gsed gnugrep go${GO_VERSION} python - run: | + pkg update -f + pkg install -y bash curl git gmake gsed gnugrep go${GO_VERSION} python + run: | set -eux mkdir bin ln -s $(which go${GO_VERSION}) bin/go @@ -141,14 +141,14 @@ jobs: gmake test-e2e echo "::endgroup::" - - name: Run end-to-end tests on DragonFly - uses: vmactions/dragonflybsd-vm@v1 + - name: Run end-to-end tests on Solaris + uses: vmactions/solaris-vm@v1 with: envs: 'GO_VERSION' usesh: true prepare: | - pkg update -f - pkg install -y bash curl git gmake gsed gnugrep go${GO_VERSION} python + pkgutil update -f + pkgutil install -y bash curl git gmake gsed gnugrep go${GO_VERSION} python run: | set -eux mkdir bin diff --git a/collector/fixtures/e2e-output-netbsd.txt b/collector/fixtures/e2e-output-netbsd.txt index e69de29bb2..468db0c5e5 100644 --- a/collector/fixtures/e2e-output-netbsd.txt +++ b/collector/fixtures/e2e-output-netbsd.txt @@ -0,0 +1,117 @@ +# HELP go_gc_duration_seconds A summary of the wall-time pause (stop-the-world) duration in garbage collection cycles. +# TYPE go_gc_duration_seconds summary +# HELP go_gc_gogc_percent Heap size target percentage configured by the user, otherwise 100. This value is set by the GOGC environment variable, and the runtime/debug.SetGCPercent function. Sourced from /gc/gogc:percent +# TYPE go_gc_gogc_percent gauge +# HELP go_gc_gomemlimit_bytes Go runtime memory limit configured by the user, otherwise math.MaxInt64. This value is set by the GOMEMLIMIT environment variable, and the runtime/debug.SetMemoryLimit function. Sourced from /gc/gomemlimit:bytes +# TYPE go_gc_gomemlimit_bytes gauge +# HELP go_goroutines Number of goroutines that currently exist. +# TYPE go_goroutines gauge +# HELP go_info Information about the Go environment. +# TYPE go_info gauge +# HELP go_memstats_alloc_bytes Number of bytes allocated in heap and currently in use. Equals to /memory/classes/heap/objects:bytes. +# TYPE go_memstats_alloc_bytes gauge +# HELP go_memstats_alloc_bytes_total Total number of bytes allocated in heap until now, even if released already. Equals to /gc/heap/allocs:bytes. +# TYPE go_memstats_alloc_bytes_total counter +# HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table. Equals to /memory/classes/profiling/buckets:bytes. +# TYPE go_memstats_buck_hash_sys_bytes gauge +# HELP go_memstats_frees_total Total number of heap objects frees. Equals to /gc/heap/frees:objects + /gc/heap/tiny/allocs:objects. +# TYPE go_memstats_frees_total counter +# HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata. Equals to /memory/classes/metadata/other:bytes. +# TYPE go_memstats_gc_sys_bytes gauge +# HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and currently in use, same as go_memstats_alloc_bytes. Equals to /memory/classes/heap/objects:bytes. +# TYPE go_memstats_heap_alloc_bytes gauge +# HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used. Equals to /memory/classes/heap/released:bytes + /memory/classes/heap/free:bytes. +# TYPE go_memstats_heap_idle_bytes gauge +# HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use. Equals to /memory/classes/heap/objects:bytes + /memory/classes/heap/unused:bytes +# TYPE go_memstats_heap_inuse_bytes gauge +# HELP go_memstats_heap_objects Number of currently allocated objects. Equals to /gc/heap/objects:objects. +# TYPE go_memstats_heap_objects gauge +# HELP go_memstats_heap_released_bytes Number of heap bytes released to OS. Equals to /memory/classes/heap/released:bytes. +# TYPE go_memstats_heap_released_bytes gauge +# HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system. Equals to /memory/classes/heap/objects:bytes + /memory/classes/heap/unused:bytes + /memory/classes/heap/released:bytes + /memory/classes/heap/free:bytes. +# TYPE go_memstats_heap_sys_bytes gauge +# HELP go_memstats_last_gc_time_seconds Number of seconds since 1970 of last garbage collection. +# TYPE go_memstats_last_gc_time_seconds gauge +# HELP go_memstats_mallocs_total Total number of heap objects allocated, both live and gc-ed. Semantically a counter version for go_memstats_heap_objects gauge. Equals to /gc/heap/allocs:objects + /gc/heap/tiny/allocs:objects. +# TYPE go_memstats_mallocs_total counter +# HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures. Equals to /memory/classes/metadata/mcache/inuse:bytes. +# TYPE go_memstats_mcache_inuse_bytes gauge +# HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system. Equals to /memory/classes/metadata/mcache/inuse:bytes + /memory/classes/metadata/mcache/free:bytes. +# TYPE go_memstats_mcache_sys_bytes gauge +# HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures. Equals to /memory/classes/metadata/mspan/inuse:bytes. +# TYPE go_memstats_mspan_inuse_bytes gauge +# HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system. Equals to /memory/classes/metadata/mspan/inuse:bytes + /memory/classes/metadata/mspan/free:bytes. +# TYPE go_memstats_mspan_sys_bytes gauge +# HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place. Equals to /gc/heap/goal:bytes. +# TYPE go_memstats_next_gc_bytes gauge +# HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations. Equals to /memory/classes/other:bytes. +# TYPE go_memstats_other_sys_bytes gauge +# HELP go_memstats_stack_inuse_bytes Number of bytes obtained from system for stack allocator in non-CGO environments. Equals to /memory/classes/heap/stacks:bytes. +# TYPE go_memstats_stack_inuse_bytes gauge +# HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator. Equals to /memory/classes/heap/stacks:bytes + /memory/classes/os-stacks:bytes. +# TYPE go_memstats_stack_sys_bytes gauge +# HELP go_memstats_sys_bytes Number of bytes obtained from system. Equals to /memory/classes/total:byte. +# TYPE go_memstats_sys_bytes gauge +# HELP go_sched_gomaxprocs_threads The current runtime.GOMAXPROCS setting, or the number of operating system threads that can execute user-level Go code simultaneously. Sourced from /sched/gomaxprocs:threads +# TYPE go_sched_gomaxprocs_threads gauge +# HELP go_threads Number of OS threads created. +# TYPE go_threads gauge +# HELP node_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, goversion from which node_exporter was built, and the goos and goarch for the build. +# TYPE node_exporter_build_info gauge +# HELP node_memory_size_bytes Memory information field size_bytes. +# TYPE node_memory_size_bytes gauge +node_memory_size_bytes 6.218080256e+09 +# HELP node_memory_swap_size_bytes Memory information field swap_size_bytes. +# TYPE node_memory_swap_size_bytes gauge +node_memory_swap_size_bytes 6.442426368e+09 +# HELP node_memory_swap_used_bytes Memory information field swap_used_bytes. +# TYPE node_memory_swap_used_bytes gauge +node_memory_swap_used_bytes 0 +# HELP node_memory_swapped_in_pages_bytes_total Memory information field swapped_in_pages_bytes_total. +# TYPE node_memory_swapped_in_pages_bytes_total counter +node_memory_swapped_in_pages_bytes_total 0 +# HELP node_memory_swapped_out_pages_bytes_total Memory information field swapped_out_pages_bytes_total. +# TYPE node_memory_swapped_out_pages_bytes_total counter +node_memory_swapped_out_pages_bytes_total 0 +# HELP node_os_info A metric with a constant '1' value labeled by build_id, id, id_like, image_id, image_version, name, pretty_name, variant, variant_id, version, version_codename, version_id. +# TYPE node_os_info gauge +node_os_info{build_id="",id="ubuntu",id_like="debian",image_id="",image_version="",name="Ubuntu",pretty_name="Ubuntu 20.04.2 LTS",variant="",variant_id="",version="20.04.2 LTS (Focal Fossa)",version_codename="focal",version_id="20.04"} 1 +# HELP node_os_version Metric containing the major.minor part of the OS version. +# TYPE node_os_version gauge +node_os_version{id="ubuntu",id_like="debian",name="Ubuntu"} 20.04 +# HELP node_scrape_collector_duration_seconds node_exporter: Duration of a collector scrape. +# TYPE node_scrape_collector_duration_seconds gauge +# HELP node_scrape_collector_success node_exporter: Whether a collector succeeded. +# TYPE node_scrape_collector_success gauge +node_scrape_collector_success{collector="boottime"} 1 +node_scrape_collector_success{collector="cpu"} 0 +node_scrape_collector_success{collector="loadavg"} 1 +node_scrape_collector_success{collector="meminfo"} 1 +node_scrape_collector_success{collector="os"} 1 +node_scrape_collector_success{collector="textfile"} 1 +node_scrape_collector_success{collector="time"} 1 +node_scrape_collector_success{collector="uname"} 1 +# HELP node_textfile_scrape_error 1 if there was an error opening or reading a file, 0 otherwise +# TYPE node_textfile_scrape_error gauge +node_textfile_scrape_error 0 +# HELP node_time_seconds System time in seconds since epoch (1970). +# TYPE node_time_seconds gauge +# HELP node_time_zone_offset_seconds System time zone offset in seconds. +# TYPE node_time_zone_offset_seconds gauge +# HELP node_uname_info Labeled system information as provided by the uname system call. +# TYPE node_uname_info gauge +node_uname_info{domainname="org",machine="amd64",nodename="vmactions",release="10.0",sysname="NetBSD",version="NetBSD 10.0 (GENERIC) #0: Thu Mar 28 08:33:33 UTC 2024 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC "} 1 +# HELP process_open_fds Number of open file descriptors. +# TYPE process_open_fds gauge +# HELP promhttp_metric_handler_errors_total Total number of internal errors encountered by the promhttp metric handler. +# TYPE promhttp_metric_handler_errors_total counter +promhttp_metric_handler_errors_total{cause="encoding"} 0 +promhttp_metric_handler_errors_total{cause="gathering"} 0 +# HELP promhttp_metric_handler_requests_in_flight Current number of scrapes being served. +# TYPE promhttp_metric_handler_requests_in_flight gauge +promhttp_metric_handler_requests_in_flight 1 +# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code. +# TYPE promhttp_metric_handler_requests_total counter +promhttp_metric_handler_requests_total{code="200"} 0 +promhttp_metric_handler_requests_total{code="500"} 0 +promhttp_metric_handler_requests_total{code="503"} 0