diff --git a/Vagrantfile b/Vagrantfile index 39084118f336..47bc686d74ff 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -132,4 +132,48 @@ Vagrant.configure("2") do |config| end end + config.vm.define "beats" do |nodeconfig| + nodeconfig.vm.box = "ubuntu/jammy64" + + # We deliberately set a fully-qualified domain name for the VM; it helps + # test the FQDN feature flag. + nodeconfig.vm.hostname = "beats-dev.elastic.dev.internal" + + nodeconfig.vm.network "private_network", + hostname: true, + ip: "192.168.56.44" # only 192.168.56.0/21 range allowed: https://www.virtualbox.org/manual/ch06.html#network_hostonly + nodeconfig.vm.network "forwarded_port", + guest: 4244, + host: 4244, + id: "delve" + + nodeconfig.vm.provider "virtualbox" do |vb| + # Display the VirtualBox GUI when booting the machine + vb.gui = false + vb.customize ["modifyvm", :id, "--vram", "128"] + # Customize the amount of memory on the VM: + vb.memory = "4096" + end + + nodeconfig.vm.provision "shell", inline: <<-SHELL + apt-get update + apt-get install -y \ + build-essential \ + curl \ + delve \ + make \ + unzip + vim \ + wget + curl -sL -o /tmp/go#{GO_VERSION}.linux-amd64.tar.gz https://go.dev/dl/go#{GO_VERSION}.linux-amd64.tar.gz + tar -C /usr/local -xzf /tmp/go#{GO_VERSION}.linux-amd64.tar.gz + curl -sL -o /tmp/mage_1.15.0_Linux-64bit.tar.gz https://github.com/magefile/mage/releases/download/v1.15.0/mage_1.15.0_Linux-64bit.tar.gz + tar -C /tmp -xf /tmp/mage_1.15.0_Linux-64bit.tar.gz + mv /tmp/mage /usr/local/bin/mage + echo "alias ll='ls -la'" > /etc/profile.d/ll.sh + echo 'export PATH=$PATH:/usr/local/go/bin' > /etc/profile.d/go.sh + echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> /etc/profile.d/go.sh + SHELL + end + end diff --git a/dev-tools/mage/gotest.go b/dev-tools/mage/gotest.go index 1f5cc791f209..99addcbac4bb 100644 --- a/dev-tools/mage/gotest.go +++ b/dev-tools/mage/gotest.go @@ -138,7 +138,7 @@ func DefaultTestBinaryArgs() TestBinaryArgs { } // GoTestIntegrationForModule executes the Go integration tests sequentially. -// Currently all test cases must be present under "./module" directory. +// Currently, all test cases must be present under "./module" directory. // // Motivation: previous implementation executed all integration tests at once, // causing high CPU load, high memory usage and resulted in timeouts. @@ -307,8 +307,11 @@ func GoTest(ctx context.Context, params GoTestArgs) error { // Generate a HTML code coverage report. var htmlCoverReport string if params.CoverageProfileFile != "" { + + htmlCoverReport = strings.TrimSuffix(params.CoverageProfileFile, filepath.Ext(params.CoverageProfileFile)) + ".html" + coverToHTML := sh.OutCmd("go", "tool", "cover", "-html="+params.CoverageProfileFile, "-o", htmlCoverReport)