github.com/vnpaycloud-console/gophercloud/v2@v2.0.5/openstack/compute/v2/diagnostics/testing/requests_test.go (about)

     1  package testing
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  
     7  	"github.com/vnpaycloud-console/gophercloud/v2/openstack/compute/v2/diagnostics"
     8  	th "github.com/vnpaycloud-console/gophercloud/v2/testhelper"
     9  	"github.com/vnpaycloud-console/gophercloud/v2/testhelper/client"
    10  )
    11  
    12  func TestGetDiagnostics(t *testing.T) {
    13  	th.SetupHTTP()
    14  	defer th.TeardownHTTP()
    15  
    16  	HandleDiagnosticGetSuccessfully(t)
    17  
    18  	expected := map[string]any{"cpu0_time": float64(173), "memory": float64(524288)}
    19  
    20  	res, err := diagnostics.Get(context.TODO(), client.ServiceClient(), "1234asdf").Extract()
    21  	th.AssertNoErr(t, err)
    22  
    23  	th.AssertDeepEquals(t, expected, res)
    24  }