github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/cce/v3/nodes/testing/fixtures.go (about)

     1  package testing
     2  
     3  import "github.com/opentelekomcloud/gophertelekomcloud/openstack/cce/v3/nodes"
     4  
     5  const Output = `{
     6      "kind": "Host",
     7      "apiVersion": "v3",
     8      "metadata": {
     9          "name": "test-node"
    10      },
    11      "spec": {
    12          "flavor": "s3.large.2",
    13          "az": "cn-east-2a",
    14          "login": {
    15              "sshKey": "test-keypair"
    16          },
    17          "rootVolume": {
    18              "volumetype": "SATA",
    19              "size": 40
    20          },
    21          "publicIP": {
    22  		      "eip": {
    23  		        "bandwidth": {}
    24  		      }
    25  		    },
    26          "dataVolumes": [
    27              {
    28                  "volumetype": "SATA",
    29                  "size": 100
    30              }
    31          ],
    32  		"runtime": {
    33            "name": "containerd"
    34          }
    35  }
    36  }`
    37  
    38  var Expected = &nodes.Nodes{
    39  	Kind:       "Host",
    40  	Apiversion: "v3",
    41  	Metadata:   nodes.Metadata{Name: "test-node"},
    42  	Spec: nodes.Spec{
    43  		Flavor: "s3.large.2",
    44  		Az:     "cn-east-2a",
    45  		Login: nodes.LoginSpec{
    46  			SshKey: "test-keypair",
    47  		},
    48  		ExtendParam: nodes.ExtendParam{},
    49  		PublicIP:    nodes.PublicIPSpec{Eip: nodes.EipSpec{Bandwidth: nodes.BandwidthOpts{}, IpType: ""}},
    50  		RootVolume: nodes.VolumeSpec{
    51  			VolumeType: "SATA",
    52  			Size:       40,
    53  		},
    54  		DataVolumes: []nodes.VolumeSpec{
    55  			{
    56  				VolumeType: "SATA",
    57  				Size:       100,
    58  			},
    59  		},
    60  		Runtime: nodes.RuntimeSpec{
    61  			Name: "containerd",
    62  		},
    63  	},
    64  }
    65  
    66  const JobOutput = `{
    67      "kind": "Job",
    68      "metadata": {
    69          "uid": "73ce052c-8b1b-11e8-8f9d-0255ac10193f"
    70      },
    71      "spec": {
    72          "type": "ScaleupCluster",
    73          "clusterUID": "6951aa4d-88ef-11e8-b196-0255ac101c43",
    74          "resourceName": "cluster-test",
    75          "subJobs": [
    76              {
    77                  "kind": "Job",
    78                  "metadata": {
    79                      "uid": "73cc28df-8b1b-11e8-8f9d-0255ac10193f"
    80                  },
    81                  "spec": {
    82                      "type": "CreateNode",
    83                      "clusterUID": "6951aa4d-88ef-11e8-b196-0255ac101c43",
    84                      "resourceName": "myhost",
    85                      "subJobs": [
    86                          {
    87                              "kind": "Job",
    88                              "metadata": {
    89                                  "uid": "73ce03fd-8b1b-11e8-8f9d-0255ac10193f"
    90                              },
    91                              "spec": {
    92                                  "type": "GetPSMCert",
    93                                  "clusterUID": "6951aa4d-88ef-11e8-b196-0255ac101c43"
    94                              },
    95                              "status": {
    96                                  "phase": "Success"
    97                              }
    98                          },
    99                          {
   100                              "kind": "Job",
   101                              "metadata": {
   102                                  "uid": "73ce0473-8b1b-11e8-8f9d-0255ac10193f"
   103                              },
   104                              "spec": {
   105                                  "type": "InstallNode",
   106                                  "clusterUID": "6951aa4d-88ef-11e8-b196-0255ac101c43",
   107                                  "resourceID": "73bd7e31-8b1b-11e8-8f9d-0255ac10193f"
   108                              },
   109                              "status": {
   110                                  "phase": "Success"
   111                              }
   112                          }
   113                      ]
   114                  }
   115              }
   116          ]
   117      },
   118      "status": {
   119          "phase": "Success"
   120      }
   121  }`
   122  
   123  var ExpectedJob = &nodes.Job{
   124  	Kind:     "Job",
   125  	Status:   nodes.JobStatus{Phase: "Success"},
   126  	Metadata: nodes.JobMetadata{ID: "73ce052c-8b1b-11e8-8f9d-0255ac10193f"},
   127  	Spec: nodes.JobSpec{Type: "ScaleupCluster",
   128  		ClusterID:    "6951aa4d-88ef-11e8-b196-0255ac101c43",
   129  		ResourceName: "cluster-test",
   130  		SubJobs: []nodes.Job{{Kind: "Job",
   131  			Metadata: nodes.JobMetadata{ID: "73cc28df-8b1b-11e8-8f9d-0255ac10193f"},
   132  			Spec: nodes.JobSpec{Type: "CreateNode",
   133  				ClusterID:    "6951aa4d-88ef-11e8-b196-0255ac101c43",
   134  				ResourceName: "myhost",
   135  				SubJobs: []nodes.Job{{Kind: "Job",
   136  					Metadata: nodes.JobMetadata{ID: "73ce03fd-8b1b-11e8-8f9d-0255ac10193f"},
   137  					Spec: nodes.JobSpec{Type: "GetPSMCert",
   138  						ClusterID: "6951aa4d-88ef-11e8-b196-0255ac101c43"},
   139  					Status: nodes.JobStatus{Phase: "Success"}},
   140  					{Kind: "Job",
   141  						Metadata: nodes.JobMetadata{ID: "73ce0473-8b1b-11e8-8f9d-0255ac10193f"},
   142  						Spec: nodes.JobSpec{Type: "InstallNode",
   143  							ClusterID:  "6951aa4d-88ef-11e8-b196-0255ac101c43",
   144  							ResourceID: "73bd7e31-8b1b-11e8-8f9d-0255ac10193f"},
   145  						Status: nodes.JobStatus{Phase: "Success"}},
   146  				},
   147  			},
   148  		}},
   149  	},
   150  }