MCPcopy Create free account
hub / github.com/apache/mesos / TEST_P

Function TEST_P

src/tests/containerizer/provisioner_docker_tests.cpp:568–691  ·  view source on GitHub ↗

This test verifies that the image tar puller could pull image with the hdfs uri fetcher plugin.

Source from the content-addressed store, hash-verified

566// This test verifies that the image tar puller could pull image
567// with the hdfs uri fetcher plugin.
568TEST_P(ProvisionerDockerHdfsTest, ROOT_ImageTarPullerHdfsFetcherSimpleCommand)
569{
570 string hadoopPath = os::getcwd();
571 ASSERT_TRUE(os::exists(hadoopPath));
572
573 string hadoopBinPath = path::join(hadoopPath, "bin");
574 ASSERT_SOME(os::mkdir(hadoopBinPath));
575 ASSERT_SOME(os::chmod(hadoopBinPath, S_IRWXU | S_IRWXG | S_IRWXO));
576
577 const string& proof = path::join(hadoopPath, "proof");
578
579 // This acts exactly as "hadoop" for testing purposes. On some platforms, the
580 // "hadoop" wrapper command will emit a warning that Hadoop installation has
581 // no native code support. We always emit that here to make sure it is parsed
582 // correctly.
583 string mockHadoopScript =
584 "#!/usr/bin/env bash\n"
585 "\n"
586 "touch " + proof + "\n"
587 "\n"
588 "now=$(date '+%y/%m/%d %I:%M:%S')\n"
589 "echo \"$now WARN util.NativeCodeLoader: "
590 "Unable to load native-hadoop library for your platform...\" 1>&2\n"
591 "\n"
592 "if [[ 'version' == $1 ]]; then\n"
593 " echo $0 'for Mesos testing'\n"
594 "fi\n"
595 "\n"
596 "# hadoop fs -copyToLocal $3 $4\n"
597 "if [[ 'fs' == $1 && '-copyToLocal' == $2 ]]; then\n"
598 " if [[ $3 == 'hdfs://'* ]]; then\n"
599 " # Remove 'hdfs://<host>/' and use just the (absolute) path.\n"
600 " withoutProtocol=${3/'hdfs:'\\/\\//}\n"
601 " withoutHost=${withoutProtocol#*\\/}\n"
602 " absolutePath='/'$withoutHost\n"
603 " cp $absolutePath $4\n"
604 " else\n"
605 " cp $3 $4\n"
606 " fi\n"
607 "fi\n";
608
609 string hadoopCommand = path::join(hadoopBinPath, "hadoop");
610 ASSERT_SOME(os::write(hadoopCommand, mockHadoopScript));
611 ASSERT_SOME(os::chmod(hadoopCommand,
612 S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH));
613
614 Try<Owned<cluster::Master>> master = StartMaster();
615 ASSERT_SOME(master);
616
617 const string directory = path::join(os::getcwd(), "archives");
618
619 Future<Nothing> testImage = DockerArchive::create(directory, "alpine");
620 AWAIT_READY(testImage);
621
622 ASSERT_TRUE(os::exists(path::join(directory, "alpine.tar")));
623
624 slave::Flags flags = CreateSlaveFlags();
625 flags.isolation = "docker/runtime,filesystem/linux";

Callers

nothing calls this directly

Calls 15

chmodFunction · 0.85
SecondsClass · 0.85
MinutesClass · 0.85
createCommandInfoFunction · 0.85
createDockerImageFunction · 0.85
listContainerRootfsesFunction · 0.85
getProvisionerDirFunction · 0.85
getContainerRootfsDirFunction · 0.85
createDetectorMethod · 0.80
CopyFromMethod · 0.80
startMethod · 0.65
launchTasksMethod · 0.65

Tested by

no test coverage detected