The attached patch adds a services resource to FPP to allow for deploy integration.

CommentFileSizeAuthor
#80 fieldable_panels_panes-n2163581-80.patch23.04 KBdamienmckenna
#80 fieldable_panels_panes-n2163581-80.interdiff.txt449 bytesdamienmckenna
#77 fieldable_panels_panes-n2163581-75.patch22.96 KBdamienmckenna
#73 fieldable_panels_panes-n2163581-73.interdiff.txt1.92 KBdamienmckenna
#73 fieldable_panels_panes-n2163581-73.patch23.24 KBdamienmckenna
#71 fieldable_panels_panes-n2163581-70.interdiff.txt1.1 KBdamienmckenna
#71 fieldable_panels_panes-n2163581-70.patch22.88 KBdamienmckenna
#66 fieldable_panels_panes-n2163581-66.interdiff.txt539 bytesdamienmckenna
#66 fieldable_panels_panes-n2163581-66.patch22.96 KBdamienmckenna
#64 fieldable_panels_panes-n2163581-64.patch22.78 KBdamienmckenna
#64 fieldable_panels_panes-n2163581-64.interdiff.txt6.54 KBdamienmckenna
#52 fieldable_panels_panes-n2163581-52.interdiff.txt4.1 KBdamienmckenna
#52 fieldable_panels_panes-n2163581-52.patch23.08 KBdamienmckenna
#49 2163581-49.patch23.04 KBmanuel garcia
#49 interdiff-2163581-42-49.txt440 bytesmanuel garcia
#42 2163581-42.patch23.01 KBmanuel garcia
#39 interdiff-2163581-35-39.txt6.62 KBmanuel garcia
#39 2163581-39.patch23.43 KBmanuel garcia
#35 2163581-35.patch23.62 KBmanuel garcia
#35 interdiff-2163581-27-35.txt316 bytesmanuel garcia
#27 2163581-27.patch23.31 KBmanuel garcia
#27 interdiff.txt23.66 KBmanuel garcia
#25 2163581-25.patch12.25 KBmanuel garcia
#25 interdiff.txt3.2 KBmanuel garcia
#15 2163581-15.patch11.62 KBmanuel garcia
#15 interdiff.txt370 bytesmanuel garcia
#13 2163581-13.patch11.6 KBmanuel garcia
#13 interdiff.txt1.85 KBmanuel garcia
#11 2163581-11.patch11.52 KBmanuel garcia
#11 interdiff.txt2.16 KBmanuel garcia
#7 2163581-7.patch9.36 KBmanuel garcia
#7 interdiff.txt3.3 KBmanuel garcia
#5 services-2163581-3.patch9.67 KBtimaholt
#2 services-2163581-2.patch9.22 KBindytechcook
fpp-services.patch0 bytesindytechcook

Comments

eft’s picture

patch seems empty

indytechcook’s picture

StatusFileSize
new9.22 KB

Attaching correct patch. Sorry!

sumitmadan’s picture

Where to add this file?

indytechcook’s picture

@sumitmaden, just apply the patch and the file will be created. see https://drupal.org/patch/apply for more info.

timaholt’s picture

StatusFileSize
new9.67 KB

There was an issue with the patch in #2, the delete function was erroneously still the bean_services_delete() function instead of the fieldable_panels_pane_services_delete() like it should have been. Fixed in new patch.

damienmckenna’s picture

Status: Needs review » Needs work

I believe this needs to have full support for revisions, as suggested by the @todo item in a comment? There are also some minor fixes needed in the comments, and at least one occasion where "Fieldable" is spelled "Fiedlable" ;)

manuel garcia’s picture

Status: Needs work » Needs review
StatusFileSize
new3.3 KB
new9.36 KB

Addressing #6:

  • Added support for revisions as suggested by the @todo
  • Fixed CS issues on some of the comments.
  • Fixed typo on "Fiedlable", searched the rest of the patch and there was only one occurrence of this.
manuel garcia’s picture

FYI: I'm in the process of adding support to fpp into deploy_addon: #2915142: Add Manage Fieldable Panels Panes page

Anyone interested feel free to have a play / review / collaborate =)

damienmckenna’s picture

Status: Needs review » Needs work

fieldable_panels_panes_services_update() still references 'bean_form', "bean" is mentioned in a few comments, and some of the function docblocks need the @return statement separated from the @params by an empty line. But it seems like it's getting close.

damienmckenna’s picture

Issue tags: +Needs tests

Also, lets add some tests to make sure the functionality works - doesn't have to be overly extensive, just the basics.

manuel garcia’s picture

Status: Needs work » Needs review
StatusFileSize
new2.16 KB
new11.52 KB

Fair enough - here's a test verifying that the services do actually appear at the right place.

damienmckenna’s picture

Status: Needs review » Needs work

Thanks Manuel!

The points about the bean comments and bean_form still stand, and that last one makes me wonder what might be broken.

manuel garcia’s picture

Status: Needs work » Needs review
StatusFileSize
new1.85 KB
new11.6 KB

Previous patch was failing with Invalid permission administer services., not very familiar with how the bot works on d7 sorry (works on my local machine), so this may require a few tries to get the module dependencies right.

While I'm at it, also addressing the bean comments and using the fpp edit form instead of the bean form for the update operation.

Status: Needs review » Needs work

The last submitted patch, 13: 2163581-13.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

manuel garcia’s picture

Status: Needs work » Needs review
StatusFileSize
new370 bytes
new11.62 KB

Let's see if this is it...

Status: Needs review » Needs work

The last submitted patch, 15: 2163581-15.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

manuel garcia’s picture

OK I'm blocked... not sure why the bot throws Invalid permission administer services, we are enabling services module which is the one providing the permission... any clues why this is happening?

damienmckenna’s picture

Ah! It's failing to enable all of the modules. Maybe the problem is because of testbot?

jonathan1055’s picture

Having been alerted to this issue via #2692407: Test_dependencies are downloaded before applying patches, rather than after I think you will need to commit just your change to .info.yml first, adding the test dependencies.

You may be able to avoid adding the new files[] = tests/fpp.deploy.test until afterwards. Do you actually need this line, if the tests are in the correct folder and named according to standards?

damienmckenna’s picture

There are no standards in D7 for automatically discovering test classes, so all tests have to specifically listed in the info file.

jonathan1055’s picture

all tests have to specifically listed in the info file.

Hmmm, well maybe, but I have just checked by deleting the two test files[] lines from a contrib module I maintain. Executing run-tests.sh --list still lists the tests to be run, and run-tests.sh --directory sites/all/modules/my_module runs all the tests for the module.

damienmckenna’s picture

That's because the test classes are cached in the registry.

damienmckenna’s picture

.. also the --directory option runs some extra magic whereby it ignores the info file entirely and just scans for files with the extension "test" (see run-tests.sh line 475 onwards).

jonathan1055’s picture

Yes, you are right, the test file information was cached, sorry. This must have been the cause for both my "sucesses" because the --directory option in run-tests.sh searches for *.php in a /tests/ folder, and the D7 files are *.test, so this also fails to find any test files if they are not listed in the .info file. Sorry to distract the issue, back on task ...

manuel garcia’s picture

Status: Needs work » Needs review
StatusFileSize
new3.2 KB
new12.25 KB

While we figure out the testing part of this, I've gone ahead and started testing this manually, the patch is indeed not ready IMHO. Attached patch at least gets the callbacks getting called, and another fix to what looks to be a residual bug form starting off from the bean services integration.

  • The index resource seems to work fine with this patch.
  • All other resources I am getting access denied, which tells me probably the access callback needs to be looked at.

I am not terribly familiar with fieldable panels panes array of permissions, but I'm guessing if we had global permissions like this, it would simplify things:

  • update fieldable panels panes
  • create fieldable panels panes
  • delete fieldable panels panes

If anyone has a better suggestion I'm all ears :)

Status: Needs review » Needs work

The last submitted patch, 25: 2163581-25.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

manuel garcia’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new23.66 KB
new23.31 KB

OK, I decided to go TDD on this, and happy to say I made a lot of progress. Debugged every resource, they are all working now, and we have full test coverage for all the services resources (passes locally but the bot will complain because of #2692407: Test_dependencies are downloaded before applying patches, rather than after).

Sorry for the big interdiff, also fixed a lot of CS along the way...

manuel garcia’s picture

Forgot to mention that we now just test services integration, so no need for test dependencies on deploy_addons etc.

Status: Needs review » Needs work

The last submitted patch, 27: 2163581-27.patch, failed testing. View results

damienmckenna’s picture

The tests give a small error:

PHP Fatal error: Class 'ServicesWebTestCase' not found in fpp.services.test on line 11

I think this is back to the problem of needing to add a composer.json with the dependencies (#2916627: Add a composer.json file to document the dependencies) so that we can then indicate services is now needed.

manuel garcia’s picture

Yeah tests fail because the bot can't detect there is a new testing dependancy. Submitted a patch to #2916627: Add a composer.json file to document the dependencies :)

manuel garcia’s picture

Status: Postponed » Needs review

Blocker is now in, let's see if the tests run properly now :)

Status: Needs review » Needs work

The last submitted patch, 27: 2163581-27.patch, failed testing. View results

manuel garcia’s picture

Status: Needs work » Needs review
StatusFileSize
new316 bytes
new23.62 KB

Let's actually make use of the new composer.json file..

Status: Needs review » Needs work

The last submitted patch, 35: 2163581-35.patch, failed testing. View results

manuel garcia’s picture

OK this is very strange, test console output throws error:
Call to undefined function services_endpoint_save() in <em class="placeholder">FppServicesTest-&gt;saveNewEndpoint()</em> (line <em class="placeholder">100</em> of <em class="placeholder">/var/www/html/sites/all/modules/fieldable_panels_panes/tests/fpp.services.test</em>)

But that function is defined in services.module, so that means that the services module is not enabled? I can see the module being pulled in using composer on the log, but only enabling simpletest. It should though, because we are listing it on our info file as a test dependency no?

damienmckenna’s picture

I'm not sure, it's confounding.

I wonder if the new dependency was committed to fieldable_panels_panes.info first? Might have to do that old trick.

BTW could you please update setUp() to follow the structure used in FPP's other tests? Thanks.

manuel garcia’s picture

StatusFileSize
new23.43 KB
new6.62 KB

Just cleaning up the test.

I wonder if the new dependency was committed to fieldable_panels_panes.info first? Might have to do that old trick.

I'll submit a new patch to get the dependency on the info file first.

manuel garcia’s picture

damienmckenna’s picture

Now that #3029146 has been committed, this needs a slight reroll.

manuel garcia’s picture

Status: Needs work » Needs review
StatusFileSize
new23.01 KB

Reroll of #39

damienmckenna’s picture

I fixed the branch tests in #3036702: Fix tests for 7.x-1.x branch, so let's see how this patch works now.

manuel garcia’s picture

Nice, thanks for the quick fix there @DamienMcKenna 🤞

Status: Needs review » Needs work

The last submitted patch, 42: 2163581-42.patch, failed testing. View results

damienmckenna’s picture

The tests fail because:

Error: Call to undefined function services_endpoint_save() in FppServicesTest->saveNewEndpoint() (line 96 of fpp.services.test).

There was a new version of the Services module out this week, maybe there was an API change?

manuel garcia’s picture

That function is still there https://cgit.drupalcode.org/services/tree/services.module?h=7.x-3.x#n447

It's the same error we were getting before #3029146: Add test dependency for services module integration got in... seems like the services module is still not being enabled for the test for some reason...

damienmckenna’s picture

Oh yeah, services needs to be added to the setUp() method.

manuel garcia’s picture

Status: Needs work » Needs review
StatusFileSize
new440 bytes
new23.04 KB

I thought that ServicesWebTestCase::setup() would enable it but well, let's give that a try.

Status: Needs review » Needs work

The last submitted patch, 49: 2163581-49.patch, failed testing. View results

damienmckenna’s picture

Sorry, I missed the fact that it was extending ServicesWebTestCase instead of FppTestHelper..

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new23.08 KB
new4.1 KB

Minor adjustments, changed to using assertEqual() instead assertTrue() for some of the assertions.

Status: Needs review » Needs work

The last submitted patch, 52: fieldable_panels_panes-n2163581-52.patch, failed testing. View results

damienmckenna’s picture

Lets get this in the next release.

damienmckenna’s picture

Per a comment from dww in slack, there's something weird with the build system where it might take "up to 24 hours" for new test dependency to take effect, so I'll try again tomorrow.

dww’s picture

+++ b/tests/fpp.services.test
@@ -0,0 +1,310 @@
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp(array $modules = array()) {
+    $modules[] = 'fieldable_panels_panes';
+    parent::setUp($modules);
+
+    $this->endpoint = $this->saveNewEndpoint();
+  }

Try explicitly enabling services here and see if that helps.

dww’s picture

For posterity:
https://www.drupal.org/docs/8/creating-custom-modules/let-drupal-8-know-...

test_dependencies - A list of other modules (in the same format as dependencies) that are needed to run certain automated tests for your module on Drupal's automated test runner ("DrupalCI"), but not needed as module dependencies in general (or that are in development as module dependencies but not finalized yet). Note that you need to have the test_dependencies change committed to your Git repository before you try to run a test that depends on it -- you cannot just put the info.yml change into the same patch as the new test. As an alternative, you can also use Composer for test dependences -- see https://www.drupal.org/docs/develop/using-composer/managing-dependencies... for more information.

(emphasis added).

Point is, if you have to wait, you first have to push a commit for test_dependencies into the .info file and then wait. ;)
-- sorry, read the backscroll and I now see #3029146: Add test dependency for services module integration.

manuel garcia’s picture

Thanks @dww for taking a look at this, was about to loose hope here :D

Re #56

Try explicitly enabling services here and see if that helps.

We already tried that on #49, but it's actually not necessary since this test extends ServicesWebTestCase which sets that up for us :)

damienmckenna’s picture

Ok, I ran the tests again, theoretically plenty of time for any cached things to be cleared, and it made no difference, the test still fails.

dww’s picture

Sorry, I've got no further ideas. The testbots have never been my area. I just saw a question in Slack and tried to help. I think this will require @mixologic to sort it out. :(

damienmckenna’s picture

Thanks for trying, @dww.

dww’s picture

Hrm, but #49 was before #3029146: Add test dependency for services module integration right? I tried re-queuing #49 now that #3029146 is done for over 24 hours, just to see what happens. ;)

Meanwhile, some other possible thoughts:

A) +test_dependencies[] = services

You might need to specify you want the 7.x-3.x branch. I think it should be smart enough to use the recommended branch, but it doesn't hurt to be explicit. This supports module dependencies:

test_dependencies:
  - duration_field:duration_field (>=8.x-2.0-rc2)

(well, that's D8 syntax, not sure about D7).

B) The branch test for services 7.x-3.x-dev is currently failing:

https://www.drupal.org/pift-ci-job/1213343

You might be doomed until you help them upstream get their testing world in order.

C) Services itself depends on ctools. I have no idea if our test bot is smart enough to get that right. Perhaps you should add "ctools" to your test_dependencies, too, just in case.

damienmckenna’s picture

Thanks again dww.

Per the console output it's downloading Services 7.x-3.23, so that part should be fine.

CTools is listed as a main dependency of the module, so it shouldn't need to be listed as a test dependency too.

The weird part is that the services tests work fine locally for both of us, which wouldn't be the case if it was something in the Services tests, so it seems like something odd with drupalci. BICBW.

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new6.54 KB
new22.78 KB

Let's add a dependencies item to getInfo(), and some other minor tweaks.

Status: Needs review » Needs work

The last submitted patch, 64: fieldable_panels_panes-n2163581-64.patch, failed testing. View results

damienmckenna’s picture

StatusFileSize
new22.96 KB
new539 bytes

Let's see if manually enabling services fixes the problem.

damienmckenna’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 66: fieldable_panels_panes-n2163581-66.patch, failed testing. View results

damienmckenna’s picture

Still the same error.

manuel garcia’s picture

Thanks @DamienMcKenna for trying to figure this one out... I'm out of ideas here, it's amazing it still throwing the same error :-s

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new22.88 KB
new1.1 KB

Minor tweaks.

Status: Needs review » Needs work

The last submitted patch, 71: fieldable_panels_panes-n2163581-70.patch, failed testing. View results

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new23.24 KB
new1.92 KB

@mixologic worked out the problem - rest_service requires the libraries module. We'll probably have to do another commit to add it as a test_dependencies line first.

damienmckenna’s picture

Status: Needs review » Needs work

I'm adding the dependency in #3037423: Add libraries as a test dependency for #2163581, because it isn't actually running the new Services test in #73. This will need a reroll after #3037423 is committed.

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new22.96 KB

Rerolled.

Status: Needs review » Needs work

The last submitted patch, 77: fieldable_panels_panes-n2163581-75.patch, failed testing. View results

damienmckenna’s picture

The tests are now *running*, but it's showing a bunch of errors.

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new449 bytes
new23.04 KB

I think I accidentally removed a line from setUp().

damienmckenna’s picture

IT'S GREEN!
:-D

manuel garcia’s picture

whohooo!! :partyparrot:

damienmckenna’s picture

Status: Needs review » Fixed

Committed! Woohoo! Thanks everyone for all your work on this!

manuel garcia’s picture

\o/

dww’s picture

Glad it worked! Yay for sorting it out.

p.s. I still don't understand d.o's issue "credit" system. The commit mentioned me, but this issue doesn't show up in the list at https://www.drupal.org/u/dww and the checkbox doesn't appear to be checked here. Are maintainers expected to manually keep these 2 in sync? *shrug*

damienmckenna’s picture

damienmckenna’s picture

@dww: That might have been my mistake when I was submitting the form, sorry. Does it show now?

dww’s picture

Indeed it does, thanks!

I don't really care, I'm mostly trying to understand how it (doesn't) work(s). ;) But thanks for fixing this, anyway. *shrug*

Cheers,
-Derek

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.