```go
package conformance
"k8s.io/client-go/kubernetes"
mcsclient "sigs.k8s.io/mcs-api/pkg/client/clientset/versioned"
const {
MCSCLIENT = "mcsclient"
K8SCLIENT = "k8sclient"
ExportFirst CreationOrder = "exportFirst"
LocalFirst CreationOrder = "localFirst"
}
type CreationOrder string
type fakeclient {
client string
}
//fake cluster clients
type clusterClients {
name string
mcsclient fakeclient
k8sclient fakeclient
}
type table struct {
Clusters []clusterClients
ServiceCreation serviceCreation
TestsThatApply []string // labels?
CleanupTimeout time.Duration
StartupTimeout time.Duration
}
type serviceCreation struct {
ServiceExport ServiceExport
Service corev1.Service
ClusterPlans []clusterPlan
}
type clusterPlan struct {
ClusterName string
CreateLocalService bool
CreateServiceExport bool
}
singleTest := table{
Clusters: [clusterClients{"cluster1", mcsclient, k8sclient}],
ServiceCluster: "cluster1",
}
doubleClusterSingleProducer := table{
Clusters: [clusterClients{"cluster1", mcsclient, k8sclient}, clusterClients{"cluster2", mcsclient, k8sclient}],
ServiceCreation: serviceCreation{
ServiceExport: {},
Service: {},
ClusterPlans: [
clusterPlan{
ClusterName: "cluster1",
CreateLocalService: true,
CreateServiceExport: true,
},
clusterPlan{
ClusterName: "cluster2",
CreateLocalService: false,
CreateServiceExport: false,
}
]
}
TestsThatApply: ["Headless L4 Connectivity", "ClusterSetIP L4 Connectivity", "ClusterSetIP L7 Connectivity", "Headless L7 Connectivity", ]
}
tripleTest := table{
Clusters: [clusterClients{"cluster1", mcsclient, k8sclient}],
StartingCluster: "cluster1",
TestsThatApply: [""]
}
func setUp(table table){
// make all the clients for the cluster plans?
}
t.Run(
// wrap variations in setup
for _, creationOrder := range creationOrders {
for test := TestsThatApply {
// In a goroutine...
// in the prescribed order:
// set up the local services for clusterplans that have them
// ASSERTION A: that remote services are NOT contactable
// set up the serviceexport for clusterplans that have them
// Wait for everything to be ready
// - created services
// - request pods
// do the test -- should have its own assertions of type "ASSERTION B"
// for example this might call when test = checkHeadlessConnectivity()
// to run the assertions we expect for Headless Connectivity
// Delete in reverse
Eventually(CleanupTimeout){
// "ASSERTION C"
}
}
}
)
func checkHeadlessConnectivity(table table){
// for each cluster in the cluster plan
// if the cluster is producing
// construct headless pod DNS for it
// and query from all the other consuming clusters
assert numPodsResponded > 10
}
```