How to use Count method of gce Package

Best Syzkaller code snippet using gce.Count

cluster_spec_test.go

Source:cluster_spec_test.go Github

copy

Full Screen

...16 "github.com/cockroachdb/datadriven"17 "github.com/stretchr/testify/require"18)19func TestClusterSpec_Args(t *testing.T) {20 const nodeCount = 1221 const instanceType = ""22 var opts []Option23 opts = append(opts, Geo())24 s := MakeClusterSpec(AWS, instanceType, nodeCount, opts...)25 t.Logf("%#v", s)26 // Regression test against a bug in which we would request an SSD machine type27 // together with the --local-ssd=false option.28 args, err := s.Args()29 require.NoError(t, err)30 act := fmt.Sprint(args)31 require.NotContains(t, act, "--aws-machine-type-ssd")32 require.Contains(t, act, "--local-ssd=false")33}34func TestClusterSpec_Args_DataDriven(t *testing.T) {35 // The following list of specs was obtained by collecting all of the specs36 // registered by tests (at the time of writing) both under `--cloud=aws` and37 // `--cloud=gce`.38 specs := []ClusterSpec{39 {40 Cloud: GCE,41 InstanceType: "",42 NodeCount: 9,43 CPUs: 4,44 SSDs: 0,45 VolumeSize: 0,46 PreferLocalSSD: true,47 Zones: "",48 Geo: false,49 Lifetime: 43200000000000,50 ReusePolicy: ReusePolicyAny{},51 },52 {53 Cloud: GCE,54 InstanceType: "",55 NodeCount: 3,56 CPUs: 2,57 SSDs: 0,58 VolumeSize: 0,59 PreferLocalSSD: true,60 Zones: "",61 Geo: false,62 Lifetime: 43200000000000,63 ReusePolicy: ReusePolicyAny{},64 },65 {66 Cloud: GCE,67 InstanceType: "",68 NodeCount: 6,69 CPUs: 2,70 SSDs: 0,71 VolumeSize: 0,72 PreferLocalSSD: true,73 Zones: "us-east1-b,us-east1-b,us-east1-b,us-west1-b,us-west1-b,europe-west2-b",74 Geo: true,75 Lifetime: 43200000000000,76 ReusePolicy: ReusePolicyAny{},77 },78 {79 Cloud: GCE,80 InstanceType: "",81 NodeCount: 9,82 CPUs: 8,83 SSDs: 0,84 VolumeSize: 0,85 PreferLocalSSD: true,86 Zones: "",87 Geo: false,88 Lifetime: 43200000000000,89 ReusePolicy: ReusePolicyAny{},90 },91 {92 Cloud: GCE,93 InstanceType: "",94 NodeCount: 7,95 CPUs: 16,96 SSDs: 0,97 VolumeSize: 0,98 PreferLocalSSD: true,99 Zones: "us-central1-a,us-central1-b,us-central1-c",100 Geo: true,101 Lifetime: 43200000000000,102 ReusePolicy: ReusePolicyAny{},103 },104 {105 Cloud: GCE,106 InstanceType: "",107 NodeCount: 4,108 CPUs: 32,109 SSDs: 0,110 VolumeSize: 0,111 PreferLocalSSD: true,112 Zones: "",113 Geo: false,114 Lifetime: 43200000000000,115 ReusePolicy: ReusePolicyAny{},116 },117 {118 Cloud: GCE,119 InstanceType: "",120 NodeCount: 1,121 CPUs: 4,122 SSDs: 0,123 VolumeSize: 0,124 PreferLocalSSD: true,125 Zones: "",126 Geo: false,127 Lifetime: 43200000000000,128 ReusePolicy: ReusePolicyTagged{Tag: "offset-injector"},129 },130 {131 Cloud: GCE,132 InstanceType: "",133 NodeCount: 32,134 CPUs: 4,135 SSDs: 0,136 VolumeSize: 0,137 PreferLocalSSD: true,138 Zones: "",139 Geo: false,140 Lifetime: 43200000000000,141 ReusePolicy: ReusePolicyAny{},142 },143 {144 Cloud: GCE,145 InstanceType: "",146 NodeCount: 6,147 CPUs: 4,148 SSDs: 0,149 VolumeSize: 0,150 PreferLocalSSD: true,151 Zones: "",152 Geo: false,153 Lifetime: 43200000000000,154 ReusePolicy: ReusePolicyTagged{Tag: "jepsen"},155 },156 {157 Cloud: GCE,158 InstanceType: "",159 NodeCount: 2,160 CPUs: 32,161 SSDs: 0,162 VolumeSize: 0,163 PreferLocalSSD: true,164 Zones: "",165 Geo: false,166 Lifetime: 43200000000000,167 ReusePolicy: ReusePolicyAny{},168 },169 {170 Cloud: GCE,171 InstanceType: "",172 NodeCount: 5,173 CPUs: 96,174 SSDs: 0,175 VolumeSize: 0,176 PreferLocalSSD: true,177 Zones: "",178 Geo: false,179 Lifetime: 43200000000000,180 ReusePolicy: ReusePolicyAny{},181 },182 {183 Cloud: GCE,184 InstanceType: "",185 NodeCount: 6,186 CPUs: 16,187 SSDs: 0,188 VolumeSize: 2500,189 PreferLocalSSD: true,190 Zones: "",191 Geo: false,192 Lifetime: 43200000000000,193 ReusePolicy: ReusePolicyAny{},194 },195 {196 Cloud: GCE,197 InstanceType: "",198 NodeCount: 9,199 CPUs: 4,200 SSDs: 0,201 VolumeSize: 0,202 PreferLocalSSD: true,203 Zones: "us-central1-b,us-west1-b,europe-west2-b",204 Geo: true,205 Lifetime: 43200000000000,206 ReusePolicy: ReusePolicyAny{},207 },208 {209 Cloud: GCE,210 InstanceType: "",211 NodeCount: 4,212 CPUs: 16,213 SSDs: 0,214 VolumeSize: 0,215 PreferLocalSSD: true,216 Zones: "",217 Geo: false,218 Lifetime: 43200000000000,219 ReusePolicy: ReusePolicyAny{},220 },221 {222 Cloud: GCE,223 InstanceType: "",224 NodeCount: 1,225 CPUs: 16,226 SSDs: 0,227 VolumeSize: 0,228 PreferLocalSSD: true,229 Zones: "",230 Geo: false,231 Lifetime: 43200000000000,232 ReusePolicy: ReusePolicyAny{},233 },234 {235 Cloud: GCE,236 InstanceType: "",237 NodeCount: 8,238 CPUs: 16,239 SSDs: 0,240 VolumeSize: 0,241 PreferLocalSSD: true,242 Zones: "europe-west2-b,europe-west4-b,asia-northeast1-b,us-west1-b",243 Geo: true,244 Lifetime: 43200000000000,245 ReusePolicy: ReusePolicyAny{},246 },247 {248 Cloud: GCE,249 InstanceType: "",250 NodeCount: 4,251 CPUs: 8,252 SSDs: 0,253 VolumeSize: 0,254 PreferLocalSSD: true,255 Zones: "",256 Geo: false,257 Lifetime: 43200000000000,258 ReusePolicy: ReusePolicyAny{},259 },260 {261 Cloud: GCE,262 InstanceType: "",263 NodeCount: 33,264 CPUs: 8,265 SSDs: 0,266 VolumeSize: 0,267 PreferLocalSSD: true,268 Zones: "",269 Geo: false,270 Lifetime: 43200000000000,271 ReusePolicy: ReusePolicyAny{},272 },273 {274 Cloud: GCE,275 InstanceType: "",276 NodeCount: 7,277 CPUs: 4,278 SSDs: 0,279 VolumeSize: 0,280 PreferLocalSSD: true,281 Zones: "",282 Geo: false,283 Lifetime: 43200000000000,284 ReusePolicy: ReusePolicyAny{},285 },286 {287 Cloud: GCE,288 InstanceType: "",289 NodeCount: 3,290 CPUs: 4,291 SSDs: 0,292 VolumeSize: 0,293 PreferLocalSSD: true,294 Zones: "us-east1-b,us-west1-b,europe-west2-b",295 Geo: true,296 Lifetime: 43200000000000,297 ReusePolicy: ReusePolicyAny{},298 },299 {300 Cloud: GCE,301 InstanceType: "",302 NodeCount: 10,303 CPUs: 4,304 SSDs: 0,305 VolumeSize: 0,306 PreferLocalSSD: true,307 Zones: "",308 Geo: false,309 Lifetime: 43200000000000,310 ReusePolicy: ReusePolicyAny{},311 },312 {313 Cloud: GCE,314 InstanceType: "",315 NodeCount: 5,316 CPUs: 16,317 SSDs: 0,318 VolumeSize: 0,319 PreferLocalSSD: true,320 Zones: "",321 Geo: false,322 Lifetime: 43200000000000,323 ReusePolicy: ReusePolicyAny{},324 },325 {326 Cloud: GCE,327 InstanceType: "",328 NodeCount: 11,329 CPUs: 8,330 SSDs: 0,331 VolumeSize: 0,332 PreferLocalSSD: true,333 Zones: "",334 Geo: false,335 Lifetime: 43200000000000,336 ReusePolicy: ReusePolicyAny{},337 },338 {339 Cloud: GCE,340 InstanceType: "",341 NodeCount: 9,342 CPUs: 1,343 SSDs: 0,344 VolumeSize: 0,345 PreferLocalSSD: true,346 Zones: "",347 Geo: false,348 Lifetime: 43200000000000,349 ReusePolicy: ReusePolicyAny{},350 },351 {352 Cloud: GCE,353 InstanceType: "",354 NodeCount: 6,355 CPUs: 32,356 SSDs: 2,357 VolumeSize: 0,358 PreferLocalSSD: true,359 Zones: "",360 Geo: false,361 Lifetime: 43200000000000,362 ReusePolicy: ReusePolicyAny{},363 },364 {365 Cloud: GCE,366 InstanceType: "",367 NodeCount: 10,368 CPUs: 16,369 SSDs: 0,370 VolumeSize: 0,371 PreferLocalSSD: true,372 Zones: "",373 Geo: false,374 Lifetime: 43200000000000,375 ReusePolicy: ReusePolicyAny{},376 },377 {378 Cloud: GCE,379 InstanceType: "",380 NodeCount: 4,381 CPUs: 96,382 SSDs: 0,383 VolumeSize: 0,384 PreferLocalSSD: true,385 Zones: "",386 Geo: false,387 Lifetime: 43200000000000,388 ReusePolicy: ReusePolicyAny{},389 },390 {391 Cloud: GCE,392 InstanceType: "",393 NodeCount: 4,394 CPUs: 4,395 SSDs: 1,396 VolumeSize: 0,397 PreferLocalSSD: true,398 Zones: "",399 Geo: false,400 Lifetime: 43200000000000,401 ReusePolicy: ReusePolicyAny{},402 },403 {404 Cloud: GCE,405 InstanceType: "",406 NodeCount: 2,407 CPUs: 8,408 SSDs: 0,409 VolumeSize: 0,410 PreferLocalSSD: true,411 Zones: "",412 Geo: false,413 Lifetime: 43200000000000,414 ReusePolicy: ReusePolicyAny{},415 },416 {417 Cloud: GCE,418 InstanceType: "",419 NodeCount: 8,420 CPUs: 4,421 SSDs: 0,422 VolumeSize: 0,423 PreferLocalSSD: true,424 Zones: "",425 Geo: false,426 Lifetime: 43200000000000,427 ReusePolicy: ReusePolicyAny{},428 },429 {430 Cloud: GCE,431 InstanceType: "",432 NodeCount: 5,433 CPUs: 4,434 SSDs: 0,435 VolumeSize: 0,436 PreferLocalSSD: true,437 Zones: "",438 Geo: false,439 Lifetime: 43200000000000,440 ReusePolicy: ReusePolicyAny{},441 },442 {443 Cloud: GCE,444 InstanceType: "",445 NodeCount: 13,446 CPUs: 16,447 SSDs: 0,448 VolumeSize: 0,449 PreferLocalSSD: true,450 Zones: "",451 Geo: false,452 Lifetime: 43200000000000,453 ReusePolicy: ReusePolicyAny{},454 },455 {456 Cloud: GCE,457 InstanceType: "",458 NodeCount: 4,459 CPUs: 4,460 SSDs: 0,461 VolumeSize: 0,462 PreferLocalSSD: true,463 Zones: "",464 Geo: false,465 Lifetime: 43200000000000,466 ReusePolicy: ReusePolicyAny{},467 },468 {469 Cloud: GCE,470 InstanceType: "",471 NodeCount: 3,472 CPUs: 4,473 SSDs: 0,474 VolumeSize: 0,475 PreferLocalSSD: true,476 Zones: "",477 Geo: false,478 Lifetime: 43200000000000,479 ReusePolicy: ReusePolicyAny{},480 },481 {482 Cloud: GCE,483 InstanceType: "",484 NodeCount: 12,485 CPUs: 4,486 SSDs: 0,487 VolumeSize: 0,488 PreferLocalSSD: true,489 Zones: "us-east1-b,us-west1-b,europe-west2-b",490 Geo: true,491 Lifetime: 43200000000000,492 ReusePolicy: ReusePolicyAny{},493 },494 {495 Cloud: GCE,496 InstanceType: "",497 NodeCount: 6,498 CPUs: 4,499 SSDs: 0,500 VolumeSize: 0,501 PreferLocalSSD: true,502 Zones: "",503 Geo: false,504 Lifetime: 43200000000000,505 ReusePolicy: ReusePolicyAny{},506 },507 {508 Cloud: GCE,509 InstanceType: "",510 NodeCount: 7,511 CPUs: 16,512 SSDs: 0,513 VolumeSize: 0,514 PreferLocalSSD: true,515 Zones: "us-east1-b,us-west1-b,europe-west2-b",516 Geo: true,517 Lifetime: 43200000000000,518 ReusePolicy: ReusePolicyAny{},519 },520 {521 Cloud: GCE,522 InstanceType: "",523 NodeCount: 21,524 CPUs: 8,525 SSDs: 0,526 VolumeSize: 0,527 PreferLocalSSD: true,528 Zones: "",529 Geo: false,530 Lifetime: 43200000000000,531 ReusePolicy: ReusePolicyAny{},532 },533 {534 Cloud: GCE,535 InstanceType: "",536 NodeCount: 6,537 CPUs: 8,538 SSDs: 0,539 VolumeSize: 0,540 PreferLocalSSD: true,541 Zones: "",542 Geo: false,543 Lifetime: 43200000000000,544 ReusePolicy: ReusePolicyAny{},545 },546 {547 Cloud: GCE,548 InstanceType: "",549 NodeCount: 2,550 CPUs: 4,551 SSDs: 0,552 VolumeSize: 0,553 PreferLocalSSD: true,554 Zones: "",555 Geo: false,556 Lifetime: 43200000000000,557 ReusePolicy: ReusePolicyAny{},558 },559 {560 Cloud: GCE,561 InstanceType: "",562 NodeCount: 1,563 CPUs: 4,564 SSDs: 0,565 VolumeSize: 0,566 PreferLocalSSD: true,567 Zones: "",568 Geo: false,569 Lifetime: 43200000000000,570 ReusePolicy: ReusePolicyAny{},571 },572 {573 Cloud: GCE,574 InstanceType: "",575 NodeCount: 10,576 CPUs: 4,577 SSDs: 0,578 VolumeSize: 0,579 PreferLocalSSD: true,580 Zones: "us-east1-b,us-west1-b,europe-west2-b",581 Geo: true,582 Lifetime: 43200000000000,583 ReusePolicy: ReusePolicyAny{},584 },585 {586 Cloud: GCE,587 InstanceType: "",588 NodeCount: 1,589 CPUs: 4,590 SSDs: 0,591 VolumeSize: 0,592 PreferLocalSSD: true,593 Zones: "",594 Geo: false,595 Lifetime: 43200000000000,596 ReusePolicy: ReusePolicyNone{},597 },598 {599 Cloud: AWS,600 InstanceType: "",601 NodeCount: 4,602 CPUs: 8,603 SSDs: 0,604 VolumeSize: 0,605 PreferLocalSSD: true,606 Zones: "",607 Geo: false,608 Lifetime: 43200000000000,609 ReusePolicy: ReusePolicyAny{},610 },611 {612 Cloud: AWS,613 InstanceType: "",614 NodeCount: 21,615 CPUs: 8,616 SSDs: 0,617 VolumeSize: 0,618 PreferLocalSSD: true,619 Zones: "",620 Geo: false,621 Lifetime: 43200000000000,622 ReusePolicy: ReusePolicyAny{},623 },624 {625 Cloud: AWS,626 InstanceType: "",627 NodeCount: 7,628 CPUs: 4,629 SSDs: 0,630 VolumeSize: 0,631 PreferLocalSSD: true,632 Zones: "",633 Geo: false,634 Lifetime: 43200000000000,635 ReusePolicy: ReusePolicyAny{},636 },637 {638 Cloud: AWS,639 InstanceType: "",640 NodeCount: 1,641 CPUs: 4,642 SSDs: 0,643 VolumeSize: 0,644 PreferLocalSSD: true,645 Zones: "",646 Geo: false,647 Lifetime: 43200000000000,648 ReusePolicy: ReusePolicyNone{},649 },650 {651 Cloud: AWS,652 InstanceType: "",653 NodeCount: 1,654 CPUs: 4,655 SSDs: 0,656 VolumeSize: 0,657 PreferLocalSSD: true,658 Zones: "",659 Geo: false,660 Lifetime: 43200000000000,661 ReusePolicy: ReusePolicyAny{},662 },663 {664 Cloud: AWS,665 InstanceType: "",666 NodeCount: 4,667 CPUs: 16,668 SSDs: 0,669 VolumeSize: 0,670 PreferLocalSSD: true,671 Zones: "",672 Geo: false,673 Lifetime: 43200000000000,674 ReusePolicy: ReusePolicyAny{},675 },676 {677 Cloud: AWS,678 InstanceType: "",679 NodeCount: 9,680 CPUs: 4,681 SSDs: 0,682 VolumeSize: 0,683 PreferLocalSSD: true,684 Zones: "",685 Geo: false,686 Lifetime: 43200000000000,687 ReusePolicy: ReusePolicyAny{},688 },689 {690 Cloud: AWS,691 InstanceType: "",692 NodeCount: 8,693 CPUs: 16,694 SSDs: 0,695 VolumeSize: 0,696 PreferLocalSSD: true,697 Zones: "europe-west2-b,europe-west4-b,asia-northeast1-b,us-west1-b",698 Geo: true,699 Lifetime: 43200000000000,700 ReusePolicy: ReusePolicyAny{},701 },702 {703 Cloud: AWS,704 InstanceType: "",705 NodeCount: 33,706 CPUs: 8,707 SSDs: 0,708 VolumeSize: 0,709 PreferLocalSSD: true,710 Zones: "",711 Geo: false,712 Lifetime: 43200000000000,713 ReusePolicy: ReusePolicyAny{},714 },715 {716 Cloud: AWS,717 InstanceType: "",718 NodeCount: 10,719 CPUs: 4,720 SSDs: 0,721 VolumeSize: 0,722 PreferLocalSSD: true,723 Zones: "us-east1-b,us-west1-b,europe-west2-b",724 Geo: true,725 Lifetime: 43200000000000,726 ReusePolicy: ReusePolicyAny{},727 },728 {729 Cloud: AWS,730 InstanceType: "",731 NodeCount: 6,732 CPUs: 32,733 SSDs: 2,734 VolumeSize: 0,735 PreferLocalSSD: true,736 Zones: "",737 Geo: false,738 Lifetime: 43200000000000,739 ReusePolicy: ReusePolicyAny{},740 },741 {742 Cloud: AWS,743 InstanceType: "",744 NodeCount: 1,745 CPUs: 16,746 SSDs: 0,747 VolumeSize: 0,748 PreferLocalSSD: true,749 Zones: "",750 Geo: false,751 Lifetime: 43200000000000,752 ReusePolicy: ReusePolicyAny{},753 },754 {755 Cloud: AWS,756 InstanceType: "",757 NodeCount: 2,758 CPUs: 32,759 SSDs: 0,760 VolumeSize: 0,761 PreferLocalSSD: true,762 Zones: "",763 Geo: false,764 Lifetime: 43200000000000,765 ReusePolicy: ReusePolicyAny{},766 },767 {768 Cloud: AWS,769 InstanceType: "",770 NodeCount: 5,771 CPUs: 96,772 SSDs: 0,773 VolumeSize: 0,774 PreferLocalSSD: true,775 Zones: "",776 Geo: false,777 Lifetime: 43200000000000,778 ReusePolicy: ReusePolicyAny{},779 },780 {781 Cloud: AWS,782 InstanceType: "",783 NodeCount: 2,784 CPUs: 4,785 SSDs: 0,786 VolumeSize: 0,787 PreferLocalSSD: true,788 Zones: "",789 Geo: false,790 Lifetime: 43200000000000,791 ReusePolicy: ReusePolicyAny{},792 },793 {794 Cloud: AWS,795 InstanceType: "",796 NodeCount: 9,797 CPUs: 1,798 SSDs: 0,799 VolumeSize: 0,800 PreferLocalSSD: true,801 Zones: "",802 Geo: false,803 Lifetime: 43200000000000,804 ReusePolicy: ReusePolicyAny{},805 },806 {807 Cloud: AWS,808 InstanceType: "",809 NodeCount: 11,810 CPUs: 8,811 SSDs: 0,812 VolumeSize: 0,813 PreferLocalSSD: true,814 Zones: "",815 Geo: false,816 Lifetime: 43200000000000,817 ReusePolicy: ReusePolicyAny{},818 },819 {820 Cloud: AWS,821 InstanceType: "",822 NodeCount: 5,823 CPUs: 16,824 SSDs: 0,825 VolumeSize: 0,826 PreferLocalSSD: true,827 Zones: "",828 Geo: false,829 Lifetime: 43200000000000,830 ReusePolicy: ReusePolicyAny{},831 },832 {833 Cloud: AWS,834 InstanceType: "",835 NodeCount: 9,836 CPUs: 4,837 SSDs: 0,838 VolumeSize: 0,839 PreferLocalSSD: true,840 Zones: "us-central1-b,us-west1-b,europe-west2-b",841 Geo: true,842 Lifetime: 43200000000000,843 ReusePolicy: ReusePolicyAny{},844 },845 {846 Cloud: AWS,847 InstanceType: "",848 NodeCount: 1,849 CPUs: 4,850 SSDs: 0,851 VolumeSize: 0,852 PreferLocalSSD: true,853 Zones: "",854 Geo: false,855 Lifetime: 43200000000000,856 ReusePolicy: ReusePolicyTagged{Tag: "offset-injector"},857 },858 {859 Cloud: AWS,860 InstanceType: "",861 NodeCount: 3,862 CPUs: 2,863 SSDs: 0,864 VolumeSize: 0,865 PreferLocalSSD: true,866 Zones: "",867 Geo: false,868 Lifetime: 43200000000000,869 ReusePolicy: ReusePolicyAny{},870 },871 {872 Cloud: AWS,873 InstanceType: "",874 NodeCount: 32,875 CPUs: 4,876 SSDs: 0,877 VolumeSize: 0,878 PreferLocalSSD: true,879 Zones: "",880 Geo: false,881 Lifetime: 43200000000000,882 ReusePolicy: ReusePolicyAny{},883 },884 {885 Cloud: AWS,886 InstanceType: "",887 NodeCount: 6,888 CPUs: 4,889 SSDs: 0,890 VolumeSize: 0,891 PreferLocalSSD: true,892 Zones: "",893 Geo: false,894 Lifetime: 43200000000000,895 ReusePolicy: ReusePolicyTagged{Tag: "jepsen"},896 },897 {898 Cloud: AWS,899 InstanceType: "",900 NodeCount: 2,901 CPUs: 8,902 SSDs: 0,903 VolumeSize: 0,904 PreferLocalSSD: true,905 Zones: "",906 Geo: false,907 Lifetime: 43200000000000,908 ReusePolicy: ReusePolicyAny{},909 },910 {911 Cloud: AWS,912 InstanceType: "",913 NodeCount: 13,914 CPUs: 16,915 SSDs: 0,916 VolumeSize: 0,917 PreferLocalSSD: true,918 Zones: "",919 Geo: false,920 Lifetime: 43200000000000,921 ReusePolicy: ReusePolicyAny{},922 },923 {924 Cloud: AWS,925 InstanceType: "",926 NodeCount: 6,927 CPUs: 8,928 SSDs: 0,929 VolumeSize: 0,930 PreferLocalSSD: true,931 Zones: "",932 Geo: false,933 Lifetime: 43200000000000,934 ReusePolicy: ReusePolicyAny{},935 },936 {937 Cloud: AWS,938 InstanceType: "",939 NodeCount: 7,940 CPUs: 16,941 SSDs: 0,942 VolumeSize: 0,943 PreferLocalSSD: true,944 Zones: "us-central1-a,us-central1-b,us-central1-c",945 Geo: true,946 Lifetime: 43200000000000,947 ReusePolicy: ReusePolicyAny{},948 },949 {950 Cloud: AWS,951 InstanceType: "",952 NodeCount: 8,953 CPUs: 4,954 SSDs: 0,955 VolumeSize: 0,956 PreferLocalSSD: true,957 Zones: "",958 Geo: false,959 Lifetime: 43200000000000,960 ReusePolicy: ReusePolicyAny{},961 },962 {963 Cloud: AWS,964 InstanceType: "",965 NodeCount: 5,966 CPUs: 4,967 SSDs: 0,968 VolumeSize: 0,969 PreferLocalSSD: true,970 Zones: "",971 Geo: false,972 Lifetime: 43200000000000,973 ReusePolicy: ReusePolicyAny{},974 },975 {976 Cloud: AWS,977 InstanceType: "",978 NodeCount: 3,979 CPUs: 4,980 SSDs: 0,981 VolumeSize: 0,982 PreferLocalSSD: true,983 Zones: "",984 Geo: false,985 Lifetime: 43200000000000,986 ReusePolicy: ReusePolicyAny{},987 },988 {989 Cloud: AWS,990 InstanceType: "",991 NodeCount: 6,992 CPUs: 4,993 SSDs: 0,994 VolumeSize: 0,995 PreferLocalSSD: true,996 Zones: "",997 Geo: false,998 Lifetime: 43200000000000,999 ReusePolicy: ReusePolicyAny{},1000 },1001 {1002 Cloud: AWS,1003 InstanceType: "",1004 NodeCount: 4,1005 CPUs: 96,1006 SSDs: 0,1007 VolumeSize: 0,1008 PreferLocalSSD: true,1009 Zones: "",1010 Geo: false,1011 Lifetime: 43200000000000,1012 ReusePolicy: ReusePolicyAny{},1013 },1014 {1015 Cloud: AWS,1016 InstanceType: "",1017 NodeCount: 4,1018 CPUs: 4,1019 SSDs: 0,1020 VolumeSize: 0,1021 PreferLocalSSD: true,1022 Zones: "",1023 Geo: false,1024 Lifetime: 43200000000000,1025 ReusePolicy: ReusePolicyAny{},1026 },1027 {1028 Cloud: AWS,1029 InstanceType: "",1030 NodeCount: 6,1031 CPUs: 2,1032 SSDs: 0,1033 VolumeSize: 0,1034 PreferLocalSSD: true,1035 Zones: "us-east1-b,us-east1-b,us-east1-b,us-west1-b,us-west1-b,europe-west2-b",1036 Geo: true,1037 Lifetime: 43200000000000,1038 ReusePolicy: ReusePolicyAny{},1039 },1040 {1041 Cloud: AWS,1042 InstanceType: "",1043 NodeCount: 4,1044 CPUs: 32,1045 SSDs: 0,1046 VolumeSize: 0,1047 PreferLocalSSD: true,1048 Zones: "",1049 Geo: false,1050 Lifetime: 43200000000000,1051 ReusePolicy: ReusePolicyAny{},1052 },1053 {1054 Cloud: AWS,1055 InstanceType: "",1056 NodeCount: 12,1057 CPUs: 4,1058 SSDs: 0,1059 VolumeSize: 0,1060 PreferLocalSSD: true,1061 Zones: "us-east1-b,us-west1-b,europe-west2-b",1062 Geo: true,1063 Lifetime: 43200000000000,1064 ReusePolicy: ReusePolicyAny{},1065 },1066 {1067 Cloud: AWS,1068 InstanceType: "",1069 NodeCount: 6,1070 CPUs: 16,1071 SSDs: 0,1072 VolumeSize: 2500,1073 PreferLocalSSD: true,1074 Zones: "",1075 Geo: false,1076 Lifetime: 43200000000000,1077 ReusePolicy: ReusePolicyAny{},1078 },1079 {1080 Cloud: AWS,1081 InstanceType: "",1082 NodeCount: 3,1083 CPUs: 4,1084 SSDs: 0,1085 VolumeSize: 0,1086 PreferLocalSSD: true,1087 Zones: "us-east-2b,us-west-1a,eu-west-1a",1088 Geo: true,1089 Lifetime: 43200000000000,1090 ReusePolicy: ReusePolicyAny{},1091 },1092 {1093 Cloud: AWS,1094 InstanceType: "",1095 NodeCount: 10,1096 CPUs: 4,1097 SSDs: 0,1098 VolumeSize: 0,1099 PreferLocalSSD: true,1100 Zones: "",1101 Geo: false,1102 Lifetime: 43200000000000,1103 ReusePolicy: ReusePolicyAny{},1104 },1105 {1106 Cloud: AWS,1107 InstanceType: "",1108 NodeCount: 10,1109 CPUs: 16,1110 SSDs: 0,1111 VolumeSize: 0,1112 PreferLocalSSD: true,1113 Zones: "",1114 Geo: false,1115 Lifetime: 43200000000000,1116 ReusePolicy: ReusePolicyAny{},1117 },1118 {1119 Cloud: AWS,1120 InstanceType: "",1121 NodeCount: 7,1122 CPUs: 16,1123 SSDs: 0,1124 VolumeSize: 0,1125 PreferLocalSSD: true,1126 Zones: "us-east-2b,us-west-1a,eu-west-1a",1127 Geo: true,1128 Lifetime: 43200000000000,1129 ReusePolicy: ReusePolicyAny{},1130 },1131 {1132 Cloud: AWS,1133 InstanceType: "",1134 NodeCount: 9,1135 CPUs: 8,1136 SSDs: 0,1137 VolumeSize: 0,1138 PreferLocalSSD: true,1139 Zones: "",1140 Geo: false,1141 Lifetime: 43200000000000,1142 ReusePolicy: ReusePolicyAny{},1143 },1144 {1145 Cloud: AWS,1146 InstanceType: "",1147 NodeCount: 4,1148 CPUs: 4,1149 SSDs: 1,1150 VolumeSize: 0,1151 PreferLocalSSD: true,1152 Zones: "",1153 Geo: false,1154 Lifetime: 43200000000000,1155 ReusePolicy: ReusePolicyAny{},1156 },1157 }1158 n := len(specs)1159 // Append a copy of the slice in which PreferLocalSSD is always false1160 // (it's always true above).1161 for i := 0; i < n; i++ {1162 s := specs[i]1163 s.PreferLocalSSD = false1164 specs = append(specs, s)1165 }1166 // Ditto but cloud is now local.1167 for i := 0; i < n; i++ {1168 s := specs[i]1169 if s.Cloud != GCE {1170 continue1171 }1172 s.Cloud = Local1173 specs = append(specs, s)1174 }1175 zfsSpecs := []ClusterSpec{1176 {1177 Cloud: GCE,1178 InstanceType: "",1179 NodeCount: 7,1180 CPUs: 16,1181 SSDs: 0,1182 VolumeSize: 0,1183 PreferLocalSSD: true,1184 Zones: "",1185 Geo: true,1186 Lifetime: 43200000000000,1187 ReusePolicy: ReusePolicyAny{},1188 FileSystem: Zfs,1189 },1190 // The following spec should error out, cause we1191 // don't support node creation with zfs on aws, yet.1192 {1193 Cloud: AWS,1194 InstanceType: "",1195 NodeCount: 7,1196 CPUs: 16,1197 SSDs: 0,1198 VolumeSize: 0,1199 PreferLocalSSD: true,1200 Zones: "",1201 Geo: true,1202 Lifetime: 43200000000000,1203 ReusePolicy: ReusePolicyAny{},1204 FileSystem: Zfs,1205 },1206 // The following spec should error out, cause we1207 // don't support node creation with zfs on azure, yet.1208 {1209 Cloud: Azure,1210 InstanceType: "",1211 NodeCount: 7,1212 CPUs: 16,1213 SSDs: 0,1214 VolumeSize: 0,1215 PreferLocalSSD: true,1216 Zones: "",1217 Geo: true,1218 Lifetime: 43200000000000,1219 ReusePolicy: ReusePolicyAny{},1220 FileSystem: Zfs,1221 },1222 }1223 specs = append(specs, zfsSpecs...)1224 path := filepath.Join("testdata", "collected_specs.txt")1225 datadriven.RunTest(t, path, func(t *testing.T, td *datadriven.TestData) string {...

Full Screen

Full Screen

gce.go

Source:gce.go Github

copy

Full Screen

...30func init() {31 vmimpl.Register("gce", ctor)32}33type Config struct {34 Count int // number of VMs to use35 Machine_Type string // GCE machine type (e.g. "n1-highcpu-2")36 GCS_Path string // GCS path to upload image37 GCE_Image string // Pre-created GCE image to use38}39type Pool struct {40 env *vmimpl.Env41 cfg *Config42 GCE *gce.Context43}44type instance struct {45 env *vmimpl.Env46 cfg *Config47 GCE *gce.Context48 debug bool49 name string50 ip string51 gceKey string // per-instance private ssh key associated with the instance52 sshKey string // ssh key53 sshUser string54 closed chan bool55}56func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {57 if env.Name == "" {58 return nil, fmt.Errorf("config param name is empty (required for GCE)")59 }60 cfg := &Config{61 Count: 1,62 }63 if err := config.LoadData(env.Config, cfg); err != nil {64 return nil, fmt.Errorf("failed to parse gce vm config: %v", err)65 }66 if cfg.Count < 1 || cfg.Count > 1000 {67 return nil, fmt.Errorf("invalid config param count: %v, want [1, 1000]", cfg.Count)68 }69 if env.Debug {70 cfg.Count = 171 }72 if cfg.Machine_Type == "" {73 return nil, fmt.Errorf("machine_type parameter is empty")74 }75 if cfg.GCE_Image == "" && cfg.GCS_Path == "" {76 return nil, fmt.Errorf("gcs_path parameter is empty")77 }78 if cfg.GCE_Image == "" && env.Image == "" {79 return nil, fmt.Errorf("config param image is empty (required for GCE)")80 }81 if cfg.GCE_Image != "" && env.Image != "" {82 return nil, fmt.Errorf("both image and gce_image are specified")83 }84 GCE, err := gce.NewContext()85 if err != nil {86 return nil, fmt.Errorf("failed to init gce: %v", err)87 }88 Logf(0, "GCE initialized: running on %v, internal IP %v, project %v, zone %v, net %v/%v",89 GCE.Instance, GCE.InternalIP, GCE.ProjectID, GCE.ZoneID, GCE.Network, GCE.Subnetwork)90 if cfg.GCE_Image == "" {91 cfg.GCE_Image = env.Name92 gcsImage := filepath.Join(cfg.GCS_Path, env.Name+"-image.tar.gz")93 Logf(0, "uploading image to %v...", gcsImage)94 if err := uploadImageToGCS(env.Image, gcsImage); err != nil {95 return nil, err96 }97 Logf(0, "creating GCE image %v...", cfg.GCE_Image)98 if err := GCE.DeleteImage(cfg.GCE_Image); err != nil {99 return nil, fmt.Errorf("failed to delete GCE image: %v", err)100 }101 if err := GCE.CreateImage(cfg.GCE_Image, gcsImage); err != nil {102 return nil, fmt.Errorf("failed to create GCE image: %v", err)103 }104 }105 pool := &Pool{106 cfg: cfg,107 env: env,108 GCE: GCE,109 }110 return pool, nil111}112func (pool *Pool) Count() int {113 return pool.cfg.Count114}115func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) {116 name := fmt.Sprintf("%v-%v", pool.env.Name, index)117 // Create SSH key for the instance.118 gceKey := filepath.Join(workdir, "key")119 keygen := osutil.Command("ssh-keygen", "-t", "rsa", "-b", "2048", "-N", "", "-C", "syzkaller", "-f", gceKey)120 if out, err := keygen.CombinedOutput(); err != nil {121 return nil, fmt.Errorf("failed to execute ssh-keygen: %v\n%s", err, out)122 }123 gceKeyPub, err := ioutil.ReadFile(gceKey + ".pub")124 if err != nil {125 return nil, fmt.Errorf("failed to read file: %v", err)126 }127 Logf(0, "deleting instance: %v", name)...

Full Screen

Full Screen

Count

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 g := gce{}4 g.Count()5}6import "fmt"7func main() {8 g := gce{}9 g.Count()10}11import "fmt"12func main() {13 g := gce{}14 g.Count()15}16import "fmt"17func main() {18 g := gce{}19 g.Count()20}21import "fmt"22func main() {23 g := gce{}24 g.Count()25}26import "fmt"27func main() {28 g := gce{}29 g.Count()30}31import "fmt"32func main() {33 g := gce{}34 g.Count()35}36import "fmt"37func main() {38 g := gce{}39 g.Count()40}41import "fmt"42func main() {43 g := gce{}44 g.Count()45}46import "fmt"47func main() {48 g := gce{}49 g.Count()50}51import "fmt"52func main() {53 g := gce{}54 g.Count()55}56import "fmt"57func main() {58 g := gce{}59 g.Count()60}61import "fmt"62func main() {63 g := gce{}

Full Screen

Full Screen

Count

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println(gce.Count())4}5func Count() int {6}7 /usr/local/go/src/pkg/./gce (from $GOROOT)8 ($GOPATH not set)9 /usr/local/go/src/pkg/./gce (from $GOROOT)10 /home/username/go/src/pkg/./gce (from $GOPATH)11 /usr/local/go/src/pkg/./gce (from $GOROOT)12 ($GOPATH not set)13 /usr/local/go/src/pkg/./gce (from $GOROOT)14 ($GOPATH not set)15 /usr/local/go/src/pkg/./gce (from $GOROOT)16 ($GOPATH not set)17 /usr/local/go/src/pkg/./gce (from $GOROOT)18 ($GOPATH not set)

Full Screen

Full Screen

Count

Using AI Code Generation

copy

Full Screen

1import (2func main() {3    gce := gce{count: 10}4    gce.Count()5}6import (7func main() {8    gce := gce{count: 10}9    gce.Count()10}11import (12func main() {13    gce := gce{count: 10}14    gce.Count()15}16import (17func main() {18    gce := gce{count: 10}19    gce.Count()20}21import (22func main() {23    gce := gce{count: 10}24    gce.Count()25}26import (27func main() {28    gce := gce{count: 10}29    gce.Count()30}31import (32func main() {33    gce := gce{count: 10}

Full Screen

Full Screen

Count

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println(x.Count())4}5The above code works fine. But if we try to use the Count() method on a variable of type GCE, we get a compilation error:6import (7func main() {8}9The Count() method is called on a pointer to the GCE type, so we must also pass a pointer to the GCE type to the Count() method. This is why we get a compilation error when we try to call the Count() method on a variable of type GCE. We need to pass a pointer to the GCE type to the Count() method, but we are passing a variable of type GCE. This is why we get

Full Screen

Full Screen

Count

Using AI Code Generation

copy

Full Screen

1import (2func Count(n ast.Node) int {3 ast.Walk(&v, n)4}5type count struct {6}7func (v *count) Visit(n ast.Node) ast.Visitor {8}9func main() {10 f, err := parser.ParseFile(fset, "1.go", nil, parser.ParseComments)11 if err != nil {12 fmt.Println(err)13 }14 fmt.Println("Count:", Count(f))15}16import (17func Count(n ast.Node) int {18 ast.Inspect(n, func(n ast.Node) bool {19 })20}21type count struct {22}23func main() {24 f, err := parser.ParseFile(fset, "1.go", nil, parser.ParseComments)25 if err != nil {26 fmt.Println(err)27 }28 fmt.Println("Count:", Count(f))29}30import (31func Count(n ast.Node) int {32 ast.Filter(&v, n)33}34type count struct {35}

Full Screen

Full Screen

Count

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Area of Circle(c) = ", c.Area())4}5import (6type Point struct {7}8func Distance(p, q Point) float64 {9 return math.Hypot(q.X-p.X, q.Y-p.Y)10}11func (path Path) Distance() float64 {12 for i := range path {13 if i > 0 {14 sum += Distance(path[i-1], path[i])15 }16 }17}18type Shape interface {19 Area() float6420}21type MultiShape struct {22}23func (m *MultiShape) Area() float64 {24 for _, s := range m.shapes {25 area += s.Area()26 }27}28func (m *MultiShape) Count() int {29 return len(m.shapes)30}31func (m *MultiShape) Add(s Shape) {32 m.shapes = append(m.shapes, s)33}34type Circle struct {35}36func (c *Circle) Area() float64 {37}38type Rectangle struct {39}40func (r *Rectangle) Area() float64 {41}42type Triangle struct {43}44func (t *Triangle) Area() float64 {45 return math.Abs((t.A.X*(t.B.Y-t.C.Y) + t.B.X*(t.C.Y-t.A.Y) + t.C.X*(t.A.Y-t.B.Y)) / 2.00)46}47func (p Path2) Distance() float64 {48 for i := range p {49 if i > 0 {50 sum += Distance(p[i-1], p[i])51 }52 }53}54type Named interface {55 Name() string56}57func NameOf(s Named) string {58 return s.Name()59}60type Person struct {

Full Screen

Full Screen

Count

Using AI Code Generation

copy

Full Screen

1import(2func main(){3 fmt.Println(gce.Count(2,3))4}5import(6func main(){7 c := gce.Calculator{}8 fmt.Println(c.Count(2,3))9}10import(11func main(){12 c := gce.Calculator{}13 fmt.Println(c.Count(2,3))14}

Full Screen

Full Screen

Count

Using AI Code Generation

copy

Full Screen

1gce := gce.NewGCE()2count := gce.Count()3fmt.Println(count)4gce := gce.NewGCE()5gce.Create()6fmt.Println(count)7gce := gce.NewGCE()8gce.Delete()9fmt.Println(count)10gce := gce.NewGCE()11list := gce.List()12fmt.Println(list)13gce := gce.NewGCE()14gce.Start()15fmt.Println(count)16gce := gce.NewGCE()17gce.Stop()18fmt.Println(count)19gce := gce.NewGCE()20gce.Update()21fmt.Println(count)22gce := gce.NewGCE()23gce.WaitFor()24fmt.Println(count)25gce := gce.NewGCE()

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful