Hướng dẫn manage your Drupal 8 module upgrade

Hướng dẫn manage your Drupal 8 module upgrade

During Drupal Dev Days in Hungary, there were many sprints that took place. You can see the amazing footage of what went on there in this nice movie, but that is not what we are going to discuss now!

In this blog post, we'll talk about how to manage your Drupal 8 module upgrade while working with many people together using a sandbox. Since drupal.org does not allow you to grant per branch access to the repository, it might be risky to allow everyone commit access. When using a sandbox you can "fork" the module and branches and allow many more people to collaborate! This is also what is happening with Search API and during our peak moment 15 people were contributing to the sandbox of Search API D8.

Now, we have a great repository for our code but unfortunately Drupal.org doesn't care too much about sandboxes for the testbots. This is most likely due to the fact that this scenario doesn't happen too often. In the meeting notes for the Search API sprinters, we all agreed we'd run tests before committing.

To enforce this we are going to utilize the modernize testbot that was written by Ricardo Amaro for the Drupal.org infrastructure team.

Warning: This tutorial is going to assume we are working on a machine that can use vagrant. If you are using a linux distro, it might be much faster to use your native machine.

Install Vagrant

Go and download Vagrant

You do need Virtualbox installed also.

Prepare yourself

git clone [email protected]:ricardoamaro/modernizing_testbot__dockerfiles.git
cd modernizing_testbot__dockerfiles
vagrant up

While vagrant is getting ready, you can sit back and relax. It takes some time as it needs to prepare your image. But once it is done, it's very quick to launch.

Log in to your vagrant box

# Log in to our vagrant box
vagrant ssh
# Going to the directory
cd modernizing_testbot__dockerfiles/
# Let's refresh what we have to be sure everything is working.
# This is optional and should not happen all the time.
sudo ./build_all.sh refresh

Run the sandbox tests

sudo TESTGROUPS="--module 'search_api'" \
DEPENDENCIES_GIT="http://git.drupal.org/sandbox/daeron/2091893.git,master" \
PATCH="https://drupal.org/files/issues/2232253-24.patch,modules/2091893" \
DRUPALBRANCH="8.x" \
./run.sh

Interpreting the results

This should output the following:

Container: testbot-web5.4 available
Running PHP5.4/mysql on drupal/testbot-web5.4
...
Applying Patch: https://drupal.org/files/issues/2232253-24.patch
------------------------- STARTING DOCKER CONTAINER ---------
Operation [start]...
...
Operation [install]...
...
Operation [run tests]...

Drupal test run
---------------
Tests to be run:
  - Drupal\search_api\Tests\IndexStorageUnitTest
  - Drupal\search_api\Tests\NodeStatusProcessorTestCase
  - Drupal\search_api\Tests\SearchApiListPageTest
  - Drupal\search_api\Tests\SearchAPILocalActionsWebTest
  - Drupal\search_api\Tests\SearchApiWebTest
  - Drupal\search_api\Tests\ServerStorageUnitTest
  - Drupal\search_api\Tests\TransliterationProcessorTestCase
  - Drupal\search_api\Tests\Menu\SearchAPILocalActionsTest
  - Drupal\search_api\Tests\Menu\SearchAPILocalTasksTest
  - Drupal\search_api\Tests\Plugin\Processor\HighlightTest
  - Drupal\search_api\Tests\Processors\HtmlFilterProcessorTest
  - Drupal\search_api\Tests\Plugin\Processor\IgnorecaseTest
  - Drupal\search_api\Tests\Plugin\Processor\StopwordsTest
Test run started:
  Thursday, April 10, 2014 - 15:01

Test summary
------------
Drupal\search_api\Tests\IndexStorageUnitTest                   5 passes
Drupal\search_api\Tests\NodeStatusProcessorTestCase           12 passes
Drupal\search_api\Tests\ServerStorageUnitTest                  5 passes
Drupal\search_api\Tests\TransliterationProcessorTestCase       8 passes
Drupal\search_api\Tests\Menu\SearchAPILocalActionsTest         1 passes
Drupal\search_api\Tests\Menu\SearchAPILocalTasksTest           0 passes   6 fails
Drupal\search_api\Tests\Plugin\Processor\HighlightTest         2 passes
Drupal\search_api\Tests\Processors\HtmlFilterProcessorTest    20 passes
Drupal\search_api\Tests\Plugin\Processor\IgnorecaseTest        1 passes
Drupal\search_api\Tests\Plugin\Processor\StopwordsTest         2 passes
Drupal\search_api\Tests\SearchAPILocalActionsWebTest          24 passes
Drupal\search_api\Tests\SearchApiWebTest                     107 passes
Drupal\search_api\Tests\SearchApiListPageTest                117 passes
Test run duration: 50 sec
...

And there we have it. We just ran the whole Search API D8 suite including PHPUnit tests using the way the drupal.org testbot would do also. The benefit here is that it is also super speedy!

To compare it, when I run the same command on my local machine I don't know if I will run the same environment as the drupal.org testbot plus it is also slower. On my own machine it takes 1 minute and 42 seconds, almost double the time it takes on the testbot on vagrant.

Tags: 
Bạn thấy bài viết này như thế nào?: 
Average: 10 (1 vote)
Ảnh của Khanh Hoang

Khanh Hoang - Kenn

Kenn is a user experience designer and front end developer who enjoys creating beautiful and usable web and mobile experiences.

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Thêm Google Maps vào trong Drupal Content

Thêm Google Maps vào trong Drupal Content

Our Drupal students frequently want to add a map to their content. In this tutorial we're going to show you how.

Ở phần SEO audit tiếp theo sẽ giới thiệu lần lượt một số công việc triển khai

Ở phần SEO audit tiếp theo sẽ giới thiệu lần lượt một số công việc triển khai

Đa phần các bước và công cụ thực hiện không phải xa lạ với mọi người, phạm vi bài viết chỉ để hệ thống lại

HTC có thể sẽ bỏ rơi S3 sau khi thua kiện Apple

HTC có thể sẽ bỏ rơi S3 sau khi thua kiện Apple

Công ty Đài Loan dự tính bỏ kế hoạch mua lại thương hiệu card đồ họa máy tính S3 (giá 300 triệu USD) do không giúp được họ trong vụ tranh chấp bản quyền với Apple.

Công ty diệt chuột T&C

 

Diet con trung