示例#1
0
func runAPIVersionsTest(c *client.Client) {
	g, err := c.ServerGroups()
	clientVersion := c.APIVersion().String()
	if err != nil {
		glog.Fatalf("Failed to get api versions: %v", err)
	}
	versions := client.ExtractGroupVersions(g)

	// Verify that the server supports the API version used by the client.
	for _, version := range versions {
		if version == clientVersion {
			glog.Infof("Version test passed")
			return
		}
	}
	glog.Fatalf("Server does not support APIVersion used by client. Server supported APIVersions: '%v', client APIVersion: '%v'", versions, clientVersion)
}