func (f *Server) TestIAMRequestsEqual(r []*cloudkms.TestIamPermissionsRequest) error {
	f.mux.Lock()
	defer f.mux.Unlock()
	if diff := cmp.Diff(f.iamTestRequestLog[len(f.iamTestRequestLog)-1], r); diff != "" {
		return fmt.Errorf("Last TestIAMPermissionsRequest differs from expected: (-want +got)\n%s", diff)
	}
	return nil
}
TestIAMRequestsEqual validates that the supplied TestIamPermissionsRequests are equal to the all
TestIamPermissionsRequests processed by the server.
package fakekms
import (
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"net"
	"net/http"
	"net/http/httptest"
	"sync"
	"time"
	"github.com/golang/glog"
	"github.com/google/go-cmp/cmp"
	"github.com/phayes/freeport"
	"google.golang.org/api/cloudkms/v1"
)
type Server struct {
	srv               *httptest.Server
	mux               sync.Mutex
	encryptRequestLog []*cloudkms.EncryptRequest
	decryptRequestLog []*cloudkms.DecryptRequest
	iamTestRequestLog []*cloudkms.TestIamPermissionsRequest
	port              int
}
func (f *Server) Client() *http.Client {
	return f.srv.Client()
}
func (f *Server) URL() string {
	return f.srv.URL
}
func (f *Server) Close() {
	f.srv.Close()
}
func (f *Server) EncryptRequestsEqual(r []*cloudkms.EncryptRequest) error {
	f.mux.Lock()
	defer f.mux.Unlock()
	if diff := cmp.Diff(f.encryptRequestLog, r); diff != "" {
		return fmt.Errorf("EncryptRequests differs from expected:(-want +got)\n%s", diff)
	}
	return nil
}
func (f *Server) DecryptRequestsEqual(r []*cloudkms.DecryptRequest) error {
	f.mux.Lock()
	defer f.mux.Unlock()
	if diff := cmp.Diff(f.decryptRequestLog, r); diff != "" {
		return fmt.Errorf("DecryptRequests differ from expected: (-want +got)\n%s", diff)
	}
	return nil
}