...

Text file src/cuelang.org/go/tools/flow/testdata/issue2416a.txtar

Documentation: cuelang.org/go/tools/flow/testdata

     1#IgnoreConcrete: true
     2#InferTasks: true
     3-- in.cue --
     4package kubecluster
     5
     6import (
     7	"list"
     8	"strings"
     9	"tool/file"
    10)
    11
    12#Cluster: {
    13	clusterName: string
    14
    15	dnsPrefix: *"kube-\(clusterName)" | string
    16	if strings.HasPrefix(clusterName, "foo_") {
    17		dnsPrefix: "foo-kube-" + strings.TrimPrefix(clusterName, "foo_")
    18	}
    19}
    20
    21clusters: [CLUSTER=string]: #Cluster & {
    22	clusterName: CLUSTER
    23}
    24
    25dnsRecords: [string]: string
    26
    27for clusterName, cluster in clusters {
    28	dnsRecords: "\(cluster.dnsPrefix)-monitoring-proxy": "127.0.0.1"
    29}
    30
    31clusters: vagrant: {
    32
    33}
    34
    35#Cluster: CLUSTER={
    36	foobar: CLUSTER.clusterName
    37}
    38
    39root: build: {
    40	$short: "exportiert gesamte Konfiguration nach ./output/"
    41
    42	task: mkdir: {
    43		output: file.MkdirAll & {path: "output"}
    44	}
    45
    46	task: "output/dns-records.zone": file.Create & {
    47		$after:   task.mkdir.output
    48		filename: "output/dns-records.zone"
    49		let lines = list.SortStrings([
    50			for name, addr in dnsRecords {
    51				"\(name) A \(addr)"
    52			},
    53		])
    54		contents: strings.Join(lines, "\n") + "\n"
    55	}
    56
    57}
    58
    59-- out/run/errors --
    60-- out/run/t0 --
    61graph TD
    62  t0("root.build.task.mkdir.output [Ready]")
    63  t1("root.build.task.#quot;output/dns-records.zone#quot; [Waiting]")
    64  t1-->t0
    65
    66-- out/run/t1 --
    67graph TD
    68  t0("root.build.task.mkdir.output [Terminated]")
    69  t1("root.build.task.#quot;output/dns-records.zone#quot; [Ready]")
    70  t1-->t0
    71
    72-- out/run/t1/value --
    73{
    74	$id:           "tool/file.Mkdir"
    75	path:          "output"
    76	createParents: true
    77	stdout:        "foo"
    78	permissions:   493
    79}
    80-- out/run/t1/stats --
    81Leaks:  0
    82Freed:  56
    83Reused: 47
    84Allocs: 9
    85Retain: 2
    86
    87Unifications: 40
    88Conjuncts:    98
    89Disjuncts:    58
    90-- out/run/t2 --
    91graph TD
    92  t0("root.build.task.mkdir.output [Terminated]")
    93  t1("root.build.task.#quot;output/dns-records.zone#quot; [Terminated]")
    94  t1-->t0
    95
    96-- out/run/t2/value --
    97{
    98	$id: "tool/file.Create"
    99	$after: {
   100		$id:           "tool/file.Mkdir"
   101		path:          "output"
   102		createParents: true
   103		stdout:        "foo"
   104		permissions:   493
   105	}
   106	filename:    "output/dns-records.zone"
   107	permissions: 438
   108	contents: """
   109		kube-vagrant-monitoring-proxy A 127.0.0.1
   110
   111		"""
   112	stdout: "foo"
   113}
   114-- out/run/t2/stats --
   115Leaks:  0
   116Freed:  57
   117Reused: 57
   118Allocs: 0
   119Retain: 2
   120
   121Unifications: 41
   122Conjuncts:    104
   123Disjuncts:    59
   124-- out/run/stats/totals --
   125Leaks:  0
   126Freed:  113
   127Reused: 104
   128Allocs: 9
   129Retain: 4
   130
   131Unifications: 81
   132Conjuncts:    202
   133Disjuncts:    117

View as plain text