github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/cce/v3/nodes/testing/fixtures.go (about)

     1  package testing
     2  
     3  import "github.com/huaweicloud/golangsdk/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          "dataVolumes": [
    22              {
    23                  "volumetype": "SATA",
    24                  "size": 100
    25              }
    26          ],
    27          "publicIP": {
    28              "eip": {
    29                "bandwidth": {}
    30              }
    31          },
    32          "runtime": {
    33              "name": "docker"
    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  		PublicIP: nodes.PublicIPSpec{Eip: nodes.EipSpec{Bandwidth: nodes.BandwidthOpts{}, IpType: ""}},
    49  		RootVolume: nodes.VolumeSpec{
    50  			VolumeType: "SATA",
    51  			Size:       40,
    52  		},
    53  		DataVolumes: []nodes.VolumeSpec{
    54  			{
    55  				VolumeType: "SATA",
    56  				Size:       100,
    57  			},
    58  		},
    59  		RunTime: &nodes.RunTimeSpec{Name: "docker"},
    60  	},
    61  }
    62  
    63  const JobOutput = `{
    64      "kind": "Job",
    65      "metadata": {
    66          "uid": "73ce052c-8b1b-11e8-8f9d-0255ac10193f"    
    67      },
    68      "spec": {
    69          "type": "ScaleupCluster",
    70          "clusterUID": "6951aa4d-88ef-11e8-b196-0255ac101c43",
    71          "resourceName": "cluster-test",
    72          "subJobs": [
    73              {
    74                  "kind": "Job",
    75                  "metadata": {
    76                      "uid": "73cc28df-8b1b-11e8-8f9d-0255ac10193f"
    77                  },
    78                  "spec": {
    79                      "type": "CreateNode",
    80                      "clusterUID": "6951aa4d-88ef-11e8-b196-0255ac101c43",
    81                      "resourceName": "myhost",
    82                      "subJobs": [
    83                          {
    84                              "kind": "Job",
    85                              "metadata": {
    86                                  "uid": "73ce03fd-8b1b-11e8-8f9d-0255ac10193f" 
    87                              },
    88                              "spec": {
    89                                  "type": "GetPSMCert",
    90                                  "clusterUID": "6951aa4d-88ef-11e8-b196-0255ac101c43"
    91                              },
    92                              "status": {
    93                                  "phase": "Success"
    94                              }
    95                          },
    96                          {
    97                              "kind": "Job",
    98                              "metadata": {
    99                                  "uid": "73ce0473-8b1b-11e8-8f9d-0255ac10193f"
   100                              },
   101                              "spec": {
   102                                  "type": "InstallNode",
   103                                  "clusterUID": "6951aa4d-88ef-11e8-b196-0255ac101c43",
   104                                  "resourceID": "73bd7e31-8b1b-11e8-8f9d-0255ac10193f"
   105                              },
   106                              "status": {
   107                                  "phase": "Success"
   108                              }
   109                          }
   110                      ]
   111                  }
   112              }
   113          ]
   114      },
   115      "status": {
   116          "phase": "Success"
   117      }
   118  }`
   119  
   120  var ExpectedJob = &nodes.Job{
   121  	Kind:     "Job",
   122  	Status:   nodes.JobStatus{Phase: "Success"},
   123  	Metadata: nodes.JobMetadata{ID: "73ce052c-8b1b-11e8-8f9d-0255ac10193f"},
   124  	Spec: nodes.JobSpec{Type: "ScaleupCluster",
   125  		ClusterID:    "6951aa4d-88ef-11e8-b196-0255ac101c43",
   126  		ResourceName: "cluster-test",
   127  		SubJobs: []nodes.Job{{Kind: "Job",
   128  			Metadata: nodes.JobMetadata{ID: "73cc28df-8b1b-11e8-8f9d-0255ac10193f"},
   129  			Spec: nodes.JobSpec{Type: "CreateNode",
   130  				ClusterID:    "6951aa4d-88ef-11e8-b196-0255ac101c43",
   131  				ResourceName: "myhost",
   132  				SubJobs: []nodes.Job{{Kind: "Job",
   133  					Metadata: nodes.JobMetadata{ID: "73ce03fd-8b1b-11e8-8f9d-0255ac10193f"},
   134  					Spec: nodes.JobSpec{Type: "GetPSMCert",
   135  						ClusterID: "6951aa4d-88ef-11e8-b196-0255ac101c43"},
   136  					Status: nodes.JobStatus{Phase: "Success"}},
   137  					{Kind: "Job",
   138  						Metadata: nodes.JobMetadata{ID: "73ce0473-8b1b-11e8-8f9d-0255ac10193f"},
   139  						Spec: nodes.JobSpec{Type: "InstallNode",
   140  							ClusterID:  "6951aa4d-88ef-11e8-b196-0255ac101c43",
   141  							ResourceID: "73bd7e31-8b1b-11e8-8f9d-0255ac10193f"},
   142  						Status: nodes.JobStatus{Phase: "Success"}},
   143  				},
   144  			},
   145  		}},
   146  	},
   147  }