github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/buildplan/raw/mock_test.go (about)

     1  package raw
     2  
     3  import (
     4  	"github.com/ActiveState/cli/pkg/platform/api/buildplanner/types"
     5  	"github.com/go-openapi/strfmt"
     6  )
     7  
     8  var buildWithSourceFromStep = &Build{
     9  	Terminals: []*NamedTarget{
    10  		{
    11  			Tag: "platform:00000000-0000-0000-0000-000000000001",
    12  			// Step 1: Traversal starts here, this one points to an artifact
    13  			NodeIDs: []strfmt.UUID{"00000000-0000-0000-0000-000000000002"},
    14  		},
    15  	},
    16  	Steps: []*Step{
    17  		{
    18  			// Step 4: From here we can find which other nodes are linked to this one
    19  			StepID:  "00000000-0000-0000-0000-000000000003",
    20  			Outputs: []string{"00000000-0000-0000-0000-000000000002"},
    21  			Inputs: []*NamedTarget{
    22  				// Step 5: Now we know which nodes are responsible for producing the output
    23  				{Tag: "src", NodeIDs: []strfmt.UUID{"00000000-0000-0000-0000-000000000004"}},
    24  			},
    25  		},
    26  		{
    27  			// Step 8: Same as step 4
    28  			StepID:  "00000000-0000-0000-0000-000000000005",
    29  			Outputs: []string{"00000000-0000-0000-0000-000000000004"},
    30  			Inputs: []*NamedTarget{
    31  				// Step 9: Same as step 5
    32  				{Tag: "src", NodeIDs: []strfmt.UUID{"00000000-0000-0000-0000-000000000006"}},
    33  			},
    34  		},
    35  	},
    36  	Artifacts: []*Artifact{
    37  		{
    38  			// Step 2: We got an artifact, but there may be more hiding behind this one
    39  			NodeID:      "00000000-0000-0000-0000-000000000002",
    40  			DisplayName: "installer",
    41  			// Step 3: Now to traverse any other input nodes that generated this one, this goes to the step
    42  			GeneratedBy: "00000000-0000-0000-0000-000000000003",
    43  		},
    44  		{
    45  			// Step 6: We have another artifact, but since this is an x-artifact we also want meta info (ingredient name, version)
    46  			NodeID:      "00000000-0000-0000-0000-000000000004",
    47  			DisplayName: "pkgOne",
    48  			// Step 7: Same as step 3
    49  			GeneratedBy: "00000000-0000-0000-0000-000000000005",
    50  		},
    51  	},
    52  	Sources: []*Source{
    53  		{
    54  			// Step 10: We have our ingredient
    55  			NodeID: "00000000-0000-0000-0000-000000000006",
    56  		},
    57  	},
    58  }
    59  
    60  var buildWithSourceFromGeneratedBy = &Build{
    61  	Terminals: []*NamedTarget{
    62  		{
    63  			Tag:     "platform:00000000-0000-0000-0000-000000000001",
    64  			NodeIDs: []strfmt.UUID{"00000000-0000-0000-0000-000000000002", "00000000-0000-0000-0000-000000000004"},
    65  		},
    66  	},
    67  	Artifacts: []*Artifact{
    68  		{
    69  			NodeID:      "00000000-0000-0000-0000-000000000002",
    70  			DisplayName: "installer",
    71  			GeneratedBy: "00000000-0000-0000-0000-000000000004",
    72  		},
    73  		{
    74  			NodeID:      "00000000-0000-0000-0000-000000000003",
    75  			DisplayName: "installer",
    76  			GeneratedBy: "00000000-0000-0000-0000-000000000004",
    77  		},
    78  	},
    79  	Sources: []*Source{
    80  		{
    81  			NodeID: "00000000-0000-0000-0000-000000000004",
    82  		},
    83  	},
    84  }
    85  
    86  var buildWithBuildDeps = &Build{
    87  	Terminals: []*NamedTarget{
    88  		{
    89  			Tag:     "platform:00000000-0000-0000-0000-000000000001",
    90  			NodeIDs: []strfmt.UUID{"00000000-0000-0000-0000-000000000002"},
    91  		},
    92  	},
    93  	Steps: []*Step{
    94  		{
    95  			StepID:  "00000000-0000-0000-0000-000000000003",
    96  			Outputs: []string{"00000000-0000-0000-0000-000000000002"},
    97  			Inputs: []*NamedTarget{
    98  				{Tag: "deps", NodeIDs: []strfmt.UUID{"00000000-0000-0000-0000-000000000004"}},
    99  			},
   100  		},
   101  	},
   102  	Artifacts: []*Artifact{
   103  		{
   104  			NodeID:      "00000000-0000-0000-0000-000000000002",
   105  			DisplayName: "installer",
   106  			GeneratedBy: "00000000-0000-0000-0000-000000000003",
   107  		},
   108  		{
   109  			NodeID:      "00000000-0000-0000-0000-000000000004",
   110  			DisplayName: "pkgOne",
   111  			GeneratedBy: "00000000-0000-0000-0000-000000000006",
   112  		},
   113  	},
   114  	Sources: []*Source{
   115  		{
   116  			NodeID: "00000000-0000-0000-0000-000000000006",
   117  		},
   118  	},
   119  }
   120  
   121  var buildWithRuntimeDeps = &Build{
   122  	Terminals: []*NamedTarget{
   123  		{
   124  			Tag:     "platform:00000000-0000-0000-0000-000000000001",
   125  			NodeIDs: []strfmt.UUID{"00000000-0000-0000-0000-000000000002"},
   126  		},
   127  	},
   128  	Artifacts: []*Artifact{
   129  		{
   130  			NodeID:      "00000000-0000-0000-0000-000000000002",
   131  			DisplayName: "installer",
   132  			MimeType:    types.XActiveStateArtifactMimeType,
   133  			RuntimeDependencies: []strfmt.UUID{
   134  				"00000000-0000-0000-0000-000000000007",
   135  			},
   136  			GeneratedBy: "00000000-0000-0000-0000-000000000003",
   137  		},
   138  		{
   139  			NodeID:      "00000000-0000-0000-0000-000000000007",
   140  			DisplayName: "pkgOne",
   141  			MimeType:    types.XActiveStateArtifactMimeType,
   142  			GeneratedBy: "00000000-0000-0000-0000-000000000008",
   143  		},
   144  	},
   145  	Sources: []*Source{
   146  		{
   147  			NodeID: "00000000-0000-0000-0000-000000000006",
   148  		},
   149  		{
   150  			NodeID: "00000000-0000-0000-0000-000000000009",
   151  		},
   152  	},
   153  }
   154  
   155  var buildWithRuntimeDepsViaSrc = &Build{
   156  	Terminals: []*NamedTarget{
   157  		{
   158  			Tag:     "platform:00000000-0000-0000-0000-000000000001",
   159  			NodeIDs: []strfmt.UUID{"00000000-0000-0000-0000-000000000002"},
   160  		},
   161  	},
   162  	Steps: []*Step{
   163  		{
   164  			StepID:  "00000000-0000-0000-0000-000000000003",
   165  			Outputs: []string{"00000000-0000-0000-0000-000000000002"},
   166  			Inputs: []*NamedTarget{
   167  				{Tag: "src", NodeIDs: []strfmt.UUID{"00000000-0000-0000-0000-000000000007"}},
   168  			},
   169  		},
   170  	},
   171  	Artifacts: []*Artifact{
   172  		{
   173  			NodeID:              "00000000-0000-0000-0000-000000000002",
   174  			DisplayName:         "installer",
   175  			MimeType:            "application/unrecognized",
   176  			RuntimeDependencies: []strfmt.UUID{},
   177  			GeneratedBy:         "00000000-0000-0000-0000-000000000003",
   178  		},
   179  		{
   180  			NodeID:      "00000000-0000-0000-0000-000000000007",
   181  			DisplayName: "pkgOne",
   182  			MimeType:    types.XActiveStateArtifactMimeType,
   183  			GeneratedBy: "00000000-0000-0000-0000-000000000008",
   184  		},
   185  	},
   186  	Sources: []*Source{
   187  		{
   188  			NodeID: "00000000-0000-0000-0000-000000000006",
   189  		},
   190  		{
   191  			NodeID: "00000000-0000-0000-0000-000000000009",
   192  		},
   193  	},
   194  }