Skip to content

Commit

Permalink
fix server
Browse files Browse the repository at this point in the history
Signed-off-by: Louise Poubel <[email protected]>
  • Loading branch information
chapulina committed Aug 26, 2021
1 parent 5163040 commit 7ee0675
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ https://ignitionfuel.org/anonymous/test_model_380348669
** Find a model on disk **
```
$ ign fuel locate --name am1
/home/developer/.ignition/fuel/staging_ignitionfuel/alice/am1
/home/developer/.ignition/fuel/fuel.ignitionrobotics.org/alice/am1
```

** C++ Get List models **
Expand Down
16 changes: 8 additions & 8 deletions src/FuelClient_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ TEST(FuelClient, DownloadWorld)
common::createDirectories("test_cache");

ServerConfig server;
server.URL("https://staging-api.ignitionfuel.org");
server.URL("https://fuel.ignitionrobotics.org");

ClientConfig config;
config.AddServer(server);
Expand All @@ -901,7 +901,7 @@ TEST(FuelClient, DownloadWorld)
{
// Unversioned URL should get the latest available version
common::URI url{
"https://staging-api.ignitionfuel.org/1.0/chapulina/worlds/Empty"};
"https://fuel.ignitionrobotics.org/1.0/chapulina/worlds/Empty"};

// Check it is not cached
std::string cachedPath;
Expand All @@ -917,30 +917,30 @@ TEST(FuelClient, DownloadWorld)

// Check it was downloaded to `1`
EXPECT_EQ(path, common::cwd() +
"/test_cache/staging-api.ignitionfuel.org/chapulina/worlds/Empty/1");
"/test_cache/fuel.ignitionrobotics.org/chapulina/worlds/Empty/1");
EXPECT_TRUE(common::exists(
"test_cache/staging-api.ignitionfuel.org/chapulina/worlds/Empty/1"));
"test_cache/fuel.ignitionrobotics.org/chapulina/worlds/Empty/1"));
EXPECT_TRUE(common::exists(
"test_cache/staging-api.ignitionfuel.org/chapulina/worlds/Empty/1/"
"test_cache/fuel.ignitionrobotics.org/chapulina/worlds/Empty/1/"
"empty.world"));

// Check it wasn't downloaded to world root directory
EXPECT_FALSE(common::exists("test_cache/staging-api.ignitionfuel.org/" +
EXPECT_FALSE(common::exists("test_cache/fuel.ignitionrobotics.org/" +
std::string("chapulina/worlds/Empty/empty.world")));

// Check it is cached
auto res3 = client.CachedWorld(url, cachedPath);
EXPECT_TRUE(res3);
EXPECT_EQ(Result(Result::FETCH_ALREADY_EXISTS), res3);
EXPECT_EQ(common::cwd() +
"/test_cache/staging-api.ignitionfuel.org/chapulina/worlds/Empty/1",
"/test_cache/fuel.ignitionrobotics.org/chapulina/worlds/Empty/1",
cachedPath);
}

// Try using nonexistent URL
{
common::URI url{
"https://staging-api.ignitionfuel.org/1.0/chapulina/worlds/Bad world"};
"https://fuel.ignitionrobotics.org/1.0/chapulina/worlds/Bad world"};
std::string path;
auto result = client.DownloadWorld(url, path);
EXPECT_FALSE(result);
Expand Down
14 changes: 7 additions & 7 deletions src/ign_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,25 +102,25 @@ TEST(CmdLine, ModelListConfigServerUgly)
TEST(CmdLine, ModelListCustomServerPretty)
{
auto output = custom_exec_str(
g_listCmd + " -t model -u https://staging-api.ignitionfuel.org");
g_listCmd + " -t model -u https://fuel.ignitionrobotics.org");

EXPECT_NE(output.find("https://staging-api.ignitionfuel.org"),
EXPECT_NE(output.find("https://fuel.ignitionrobotics.org"),
std::string::npos) << output;
EXPECT_NE(output.find("owners"), std::string::npos) << output;
EXPECT_NE(output.find("models"), std::string::npos) << output;

EXPECT_EQ(output.find("https://api.ignitionfuel.org"), std::string::npos)
<< output;
EXPECT_EQ(output.find("https://staging-api.ignitionfuel.org/1.0/"),
EXPECT_EQ(output.find("https://fuel.ignitionrobotics.org/1.0/"),
std::string::npos) << output;
}

/////////////////////////////////////////////////
TEST(CmdLine, WorldListConfigServerUgly)
{
auto output = custom_exec_str(g_listCmd +
" -t world --raw -u https://staging-api.ignitionfuel.org");
EXPECT_NE(output.find("https://staging-api.ignitionfuel.org/1.0/"),
" -t world --raw -u https://fuel.ignitionrobotics.org");
EXPECT_NE(output.find("https://fuel.ignitionrobotics.org/1.0/"),
std::string::npos) << output;
EXPECT_EQ(output.find("owners"), std::string::npos) << output;
}
Expand All @@ -129,9 +129,9 @@ TEST(CmdLine, WorldListConfigServerUgly)
TEST(CmdLine, WorldListCustomServerPretty)
{
auto output = custom_exec_str(
g_listCmd + " -t world -u https://staging-api.ignitionfuel.org");
g_listCmd + " -t world -u https://fuel.ignitionrobotics.org");

EXPECT_NE(output.find("https://staging-api.ignitionfuel.org"),
EXPECT_NE(output.find("https://fuel.ignitionrobotics.org"),
std::string::npos) << output;
EXPECT_NE(output.find("owners"), std::string::npos) << output;
EXPECT_NE(output.find("worlds"), std::string::npos) << output;
Expand Down
36 changes: 18 additions & 18 deletions src/ign_src_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ TEST(CmdLine, ModelListCustomServerPretty)
std::stringstream stdErrBuffer;
redirectIO(stdOutBuffer, stdErrBuffer);

EXPECT_TRUE(listModels("https://staging-api.ignitionfuel.org"));
EXPECT_TRUE(listModels("https://fuel.ignitionrobotics.org"));

EXPECT_NE(stdOutBuffer.str().find("https://staging-api.ignitionfuel.org"),
EXPECT_NE(stdOutBuffer.str().find("https://fuel.ignitionrobotics.org"),
std::string::npos) << stdOutBuffer.str();
EXPECT_NE(stdOutBuffer.str().find("owners"), std::string::npos)
<< stdOutBuffer.str();
Expand All @@ -111,7 +111,7 @@ TEST(CmdLine, ModelListCustomServerPretty)
EXPECT_EQ(stdOutBuffer.str().find("https://api.ignitionfuel.org"),
std::string::npos) << stdOutBuffer.str();
EXPECT_EQ(stdOutBuffer.str().find(
"https://staging-api.ignitionfuel.org/1.0/"), std::string::npos)
"https://fuel.ignitionrobotics.org/1.0/"), std::string::npos)
<< stdOutBuffer.str();

clearIOStreams(stdOutBuffer, stdErrBuffer);
Expand All @@ -125,10 +125,10 @@ TEST(CmdLine, ModelListCustomServerPrettyOwner)
std::stringstream stdErrBuffer;
redirectIO(stdOutBuffer, stdErrBuffer);

EXPECT_TRUE(listModels("https://staging-api.ignitionfuel.org",
EXPECT_TRUE(listModels("https://fuel.ignitionrobotics.org",
"openrobotics"));

EXPECT_NE(stdOutBuffer.str().find("https://staging-api.ignitionfuel.org"),
EXPECT_NE(stdOutBuffer.str().find("https://fuel.ignitionrobotics.org"),
std::string::npos) << stdOutBuffer.str();
EXPECT_NE(stdOutBuffer.str().find("1 owners"), std::string::npos)
<< stdOutBuffer.str();
Expand All @@ -142,7 +142,7 @@ TEST(CmdLine, ModelListCustomServerPrettyOwner)
EXPECT_EQ(stdOutBuffer.str().find("https://api.ignitionfuel.org"),
std::string::npos) << stdOutBuffer.str();
EXPECT_EQ(stdOutBuffer.str().find(
"https://staging-api.ignitionfuel.org/1.0/"), std::string::npos)
"https://fuel.ignitionrobotics.org/1.0/"), std::string::npos)
<< stdOutBuffer.str();

clearIOStreams(stdOutBuffer, stdErrBuffer);
Expand Down Expand Up @@ -242,9 +242,9 @@ TEST(CmdLine, WorldListConfigServerUgly)
std::stringstream stdErrBuffer;
redirectIO(stdOutBuffer, stdErrBuffer);

EXPECT_TRUE(listWorlds("https://staging-api.ignitionfuel.org", "", "true"));
EXPECT_TRUE(listWorlds("https://fuel.ignitionrobotics.org", "", "true"));

EXPECT_NE(stdOutBuffer.str().find("https://staging-api.ignitionfuel.org"),
EXPECT_NE(stdOutBuffer.str().find("https://fuel.ignitionrobotics.org"),
std::string::npos) << stdOutBuffer.str();
EXPECT_EQ(stdOutBuffer.str().find("owners"), std::string::npos)
<< stdOutBuffer.str();
Expand All @@ -260,9 +260,9 @@ TEST(CmdLine, WorldListCustomServerPretty)
std::stringstream stdErrBuffer;
redirectIO(stdOutBuffer, stdErrBuffer);

EXPECT_TRUE(listWorlds("https://staging-api.ignitionfuel.org"));
EXPECT_TRUE(listWorlds("https://fuel.ignitionrobotics.org"));

EXPECT_NE(stdOutBuffer.str().find("https://staging-api.ignitionfuel.org"),
EXPECT_NE(stdOutBuffer.str().find("https://fuel.ignitionrobotics.org"),
std::string::npos) << stdOutBuffer.str();
EXPECT_NE(stdOutBuffer.str().find("owners"), std::string::npos)
<< stdOutBuffer.str();
Expand All @@ -272,7 +272,7 @@ TEST(CmdLine, WorldListCustomServerPretty)
EXPECT_EQ(stdOutBuffer.str().find("https://api.ignitionfuel.org"),
std::string::npos) << stdOutBuffer.str();
EXPECT_EQ(stdOutBuffer.str().find(
"https://staging-api.ignitionfuel.org/1.0/"), std::string::npos)
"https://fuel.ignitionrobotics.org/1.0/"), std::string::npos)
<< stdOutBuffer.str();

clearIOStreams(stdOutBuffer, stdErrBuffer);
Expand All @@ -286,10 +286,10 @@ TEST(CmdLine, WorldListCustomServerPrettyOwner)
std::stringstream stdErrBuffer;
redirectIO(stdOutBuffer, stdErrBuffer);

EXPECT_TRUE(listWorlds("https://staging-api.ignitionfuel.org",
EXPECT_TRUE(listWorlds("https://fuel.ignitionrobotics.org",
"chapulina"));

EXPECT_NE(stdOutBuffer.str().find("https://staging-api.ignitionfuel.org"),
EXPECT_NE(stdOutBuffer.str().find("https://fuel.ignitionrobotics.org"),
std::string::npos) << stdOutBuffer.str();
EXPECT_NE(stdOutBuffer.str().find("1 owners"), std::string::npos)
<< stdOutBuffer.str();
Expand All @@ -303,7 +303,7 @@ TEST(CmdLine, WorldListCustomServerPrettyOwner)
EXPECT_EQ(stdOutBuffer.str().find("https://api.ignitionfuel.org"),
std::string::npos) << stdOutBuffer.str();
EXPECT_EQ(stdOutBuffer.str().find(
"https://staging-api.ignitionfuel.org/1.0/"), std::string::npos)
"https://fuel.ignitionrobotics.org/1.0/"), std::string::npos)
<< stdOutBuffer.str();

clearIOStreams(stdOutBuffer, stdErrBuffer);
Expand Down Expand Up @@ -360,7 +360,7 @@ TEST(CmdLine, WorldDownloadUnversioned)

// Download
EXPECT_TRUE(downloadUrl(
"https://staging-api.ignitionfuel.org/1.0/chapulina/worlds/Empty"));
"https://fuel.ignitionrobotics.org/1.0/chapulina/worlds/Empty"));

// Check output
EXPECT_NE(stdOutBuffer.str().find("Download succeeded"),
Expand All @@ -369,11 +369,11 @@ TEST(CmdLine, WorldDownloadUnversioned)

// Check files
EXPECT_TRUE(ignition::common::isDirectory(
"test_cache/staging-api.ignitionfuel.org/chapulina/worlds/Empty"));
"test_cache/fuel.ignitionrobotics.org/chapulina/worlds/Empty"));
EXPECT_TRUE(ignition::common::isDirectory(
"test_cache/staging-api.ignitionfuel.org/chapulina/worlds/Empty/1"));
"test_cache/fuel.ignitionrobotics.org/chapulina/worlds/Empty/1"));
EXPECT_TRUE(ignition::common::isFile(
std::string("test_cache/staging-api.ignitionfuel.org/chapulina/worlds/")
std::string("test_cache/fuel.ignitionrobotics.org/chapulina/worlds/")
+ "Empty/1/empty.world"));

clearIOStreams(stdOutBuffer, stdErrBuffer);
Expand Down

0 comments on commit 7ee0675

Please sign in to comment.