Merge lp:~mvo/unity-scope-click/empty-frameworks-query into lp:unity-scope-click/devel

Proposed by Michael Vogt
Status: Rejected
Rejected by: dobey
Proposed branch: lp:~mvo/unity-scope-click/empty-frameworks-query
Merge into: lp:unity-scope-click/devel
Diff against target: 58 lines (+16/-2)
4 files modified
HACKING (+4/-0)
scope/click/index.cpp (+4/-1)
scope/click/index.h (+0/-1)
scope/tests/test_index.cpp (+8/-0)
To merge this branch: bzr merge lp:~mvo/unity-scope-click/empty-frameworks-query
Reviewer Review Type Date Requested Status
dobey (community) Disapprove
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+220083@code.launchpad.net

Description of the change

This branch sends a empty "framework:" string if the system has no frameworks installed.

The search scope will return all apps for the given search query if the ",framework:" is missing but when the user tries to install the click app click will fail.

I ran into this when testing unity8-desktop-session-mir. If you feel like this should be fixed on the server side instead, please simply close this MP.

To post a comment you must log in.
264. By Michael Vogt

improve test

265. By Michael Vogt

HACKING: mention how to run a specific test only

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
dobey (dobey) wrote :

I'm voting Disapprove here, because it directly conflicts with your other branch https://code.launchpad.net/~mvo/unity-scope-click/lp1292645-use-libclick/+merge/220061 and I'm not sure it's the solution we should be going for here.

Also, please file a new bug for this issue where results are given, but not installable, when there are no frameworks. As the frameworks data is a core piece of information we depend on for a working scope, I think we should fail when they are none available, and have a runtime dependency on the package that provides them (ubuntu-sdk-libs).

review: Disapprove
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks Rodney for your review. I created bug #1320975 as requested.

I don't really see the conflict with my other branch here, configuration->get_available_frameworks() may still return a empty array (but maybe I'm missing something).

But if there is going to be a dependency on the ubuntu-sdk-libs package this branch will not be needed.

Revision history for this message
dobey (dobey) wrote :

On Mon, 2014-05-19 at 18:43 +0000, Michael Vogt wrote:
> I don't really see the conflict with my other branch here,
> configuration->get_available_frameworks() may still return a empty
> array (but maybe I'm missing something).

Oh, sorry. I was reading the change in index.cpp here, and
configuration.cpp there, as the same code. :)

This branch does conflict with the tip of /devel now though. But I still
think this isn't how we should fix the issue, and instead we should have
a proper dependency on the data from other packages we need, and should
fail appropriately rather than trying to pass empty data to the server.
Although, I think tip of /devel will pass empty data to the server now
anyway, as we're passing an empty header, rather than not passing
frameworks at all, in the empty list case.

Unmerged revisions

265. By Michael Vogt

HACKING: mention how to run a specific test only

264. By Michael Vogt

improve test

263. By Michael Vogt

send empty frameworks string if no frameworks are installed

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'HACKING'
--- HACKING 2014-05-16 21:08:36 +0000
+++ HACKING 2014-05-19 15:22:38 +0000
@@ -37,6 +37,10 @@
3737
38 $ make check-valgrind38 $ make check-valgrind
3939
40Running a specific test with:
41
42 $ ./scope/tests/click-scope-tests --gtest_filter=QueryStringTest.testBuildQueryNoInstalledFrameworks
43
4044
41Running the autopilot tests45Running the autopilot tests
42---------------------------46---------------------------
4347
=== modified file 'scope/click/index.cpp'
--- scope/click/index.cpp 2014-04-16 21:13:28 +0000
+++ scope/click/index.cpp 2014-05-19 15:22:38 +0000
@@ -92,7 +92,10 @@
92 std::stringstream result;92 std::stringstream result;
9393
94 result << query;94 result << query;
95 for (auto f: configuration->get_available_frameworks()) {95 auto available_frameworks = configuration->get_available_frameworks();
96 if (available_frameworks.size() == 0)
97 result << ",framework:";
98 for (auto f: available_frameworks) {
96 result << ",framework:" << f;99 result << ",framework:" << f;
97 }100 }
98 result << ",architecture:" << configuration->get_architecture();101 result << ",architecture:" << configuration->get_architecture();
99102
=== modified file 'scope/click/index.h'
--- scope/click/index.h 2014-04-16 21:13:28 +0000
+++ scope/click/index.h 2014-05-19 15:22:38 +0000
@@ -46,7 +46,6 @@
46const std::string SEARCH_BASE_URL_ENVVAR = "U1_SEARCH_BASE_URL";46const std::string SEARCH_BASE_URL_ENVVAR = "U1_SEARCH_BASE_URL";
47const std::string SEARCH_BASE_URL = "https://search.apps.ubuntu.com/";47const std::string SEARCH_BASE_URL = "https://search.apps.ubuntu.com/";
48const std::string SEARCH_PATH = "api/v1/search";48const std::string SEARCH_PATH = "api/v1/search";
49const std::string SUPPORTED_FRAMEWORKS = "framework:ubuntu-sdk-13.10";
50const std::string QUERY_ARGNAME = "q";49const std::string QUERY_ARGNAME = "q";
51const std::string ARCHITECTURE = "architecture:";50const std::string ARCHITECTURE = "architecture:";
52const std::string DETAILS_PATH = "api/v1/package/";51const std::string DETAILS_PATH = "api/v1/package/";
5352
=== modified file 'scope/tests/test_index.cpp'
--- scope/tests/test_index.cpp 2014-04-29 03:17:38 +0000
+++ scope/tests/test_index.cpp 2014-05-19 15:22:38 +0000
@@ -496,3 +496,11 @@
496 EXPECT_NE(std::string::npos, index_query.find("framework:" + fake_fwk_1));496 EXPECT_NE(std::string::npos, index_query.find("framework:" + fake_fwk_1));
497 EXPECT_NE(std::string::npos, index_query.find("framework:" + fake_fwk_2));497 EXPECT_NE(std::string::npos, index_query.find("framework:" + fake_fwk_2));
498}498}
499
500TEST_F(QueryStringTest, testBuildQueryNoInstalledFrameworks)
501{
502 EXPECT_CALL(*configPtr, get_architecture()).Times(1).WillOnce(Return(fake_arch));
503 EXPECT_CALL(*configPtr, get_available_frameworks()).Times(1).WillOnce(Return(std::vector<std::string>()));
504 auto index_query = indexPtr->build_index_query("fake");
505 EXPECT_EQ("fake,framework:,architecture:fake_arch", index_query);
506}

Subscribers

People subscribed via source and target branches

to all changes: