| 97 | |
| 98 | |
| 99 | master::Flags MesosTest::CreateMasterFlags() |
| 100 | { |
| 101 | master::Flags flags; |
| 102 | |
| 103 | // We use the current working directory from TempDirectoryTest |
| 104 | // to ensure the work directory remains the same within a test. |
| 105 | flags.work_dir = path::join(os::getcwd(), "master"); |
| 106 | |
| 107 | CHECK_SOME(os::mkdir(flags.work_dir.get())); |
| 108 | |
| 109 | flags.authenticate_http_readonly = true; |
| 110 | flags.authenticate_http_readwrite = true; |
| 111 | flags.authenticate_frameworks = true; |
| 112 | flags.authenticate_agents = true; |
| 113 | |
| 114 | flags.authenticate_http_frameworks = true; |
| 115 | flags.http_framework_authenticators = "basic"; |
| 116 | |
| 117 | // Create a default credentials file. |
| 118 | const string& path = path::join(os::getcwd(), "credentials"); |
| 119 | |
| 120 | Try<int_fd> fd = os::open( |
| 121 | path, |
| 122 | O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, |
| 123 | S_IRUSR | S_IWUSR | S_IRGRP); |
| 124 | |
| 125 | CHECK_SOME(fd); |
| 126 | |
| 127 | // JSON default format for credentials. |
| 128 | Credentials credentials; |
| 129 | |
| 130 | Credential* credential = credentials.add_credentials(); |
| 131 | credential->set_principal(DEFAULT_CREDENTIAL.principal()); |
| 132 | credential->set_secret(DEFAULT_CREDENTIAL.secret()); |
| 133 | |
| 134 | credential = credentials.add_credentials(); |
| 135 | credential->set_principal(DEFAULT_CREDENTIAL_2.principal()); |
| 136 | credential->set_secret(DEFAULT_CREDENTIAL_2.secret()); |
| 137 | |
| 138 | CHECK_SOME(os::write(fd.get(), stringify(JSON::protobuf(credentials)))) |
| 139 | << "Failed to write credentials to '" << path << "'"; |
| 140 | CHECK_SOME(os::close(fd.get())); |
| 141 | |
| 142 | flags.credentials = path; |
| 143 | |
| 144 | // Set default ACLs. |
| 145 | flags.acls = ACLs(); |
| 146 | |
| 147 | // Use the in-memory registry (instead of the replicated log) by default. |
| 148 | // TODO(josephw): Consider changing this back to `replicated_log` once |
| 149 | // all platforms support this registrar backend. |
| 150 | flags.registry = "in_memory"; |
| 151 | |
| 152 | // On many test VMs, this default is too small. |
| 153 | flags.registry_store_timeout = flags.registry_store_timeout * 5; |
| 154 | |
| 155 | flags.authenticators = tests::flags.authenticators; |
| 156 |
no test coverage detected