1. 首页
  2. 编程语言
  3. 其他
  4. [Test-Driven.Infrastructure.with.Chef(2nd,2013.10)].Stephen.Nelson-Smith.文字版.pdf

[Test-Driven.Infrastructure.with.Chef(2nd,2013.10)].Stephen.Nelson-Smith.文字版.pdf

上传者: 2018-12-25 19:12:33上传 PDF文件 7.13MB 热度 41次
Writing the first edition of this book was an order of magnitude harder than I couldever have imagined. I think this is largely because alongside writing a book I was alsowriting software. Trying to do both things concurrently took up vast quantities of time,for which many people are owed a debt SECOND EDITIONTest-Driven Infrastructurewith chefStephen Nelson-SmithBeijing· Cambridge.mham·Kh· Sebastopol. TokyoOREILLYTest-Driven Infrastructure with chef second editionby Stephen Nelson-SmithCopyright@ 2014 Atalanta Systems LTD.. All rights reservedPrinted in the United States of americaPublished by o reilly media, InC., 1005 Gravenstein Highway North, Sebastopol, CA 95472OReilly books may be purchased for educational, business, or sales promotional use Online editions arealsoavailableformosttitles(http://my.safaribooksonline.com).fOrmoreinformation,contactourcorporateinstitutionalsalesdepartment800-998-9938orcorporate@oreilly.comEditors: Mike Loukides and Meghan blanchetteCover Designer: Randy ComerProduction Editor: Melanie YarbroughInterior Designer: David FutatoProofreader: Elise morrisonllustrator: Rebecca demarestIndexer: Word Co Indexing ServicesOctober 2013:Second editionRevision history for the Second edition:2013-10-10 First releaseSeehttp://oreilly.com/catalog/errata.csp?isbn=9781449372200forreleasedetailsNutshell Handbook, the Nutshell Handbook logo, and the O Reilly logo are registered trademarks ofO ReillyMedia, Inc. Test-Driven Infrastructure with Chef, the cover image of an edible-nest swiftlet, and related tradedress are trademarks of o reilly media, IncMany of the designations used by manufacturers and sellers to distinguish their products are claimed astrademarks. Where those designations appear in this book, and O Reilly Media, Inc, was aware of a trademark claim, the designations have been printed in caps or initial capsWhile every precaution has been taken in the preparation of this book, the publisher and authors assumeno responsibility forerrors or omissions, or for damages resulting from the use of the information containedhereinISBN:978-1-449-37220-0Table of contentsPreface1. The Philosophy of Test-Driven Infrastructure.Underpinning PhilosophyInfrastructure as Code122The Origins of Infrastructure as CodeThe Principles of infrastructure as CodeThe Risks of Infrastructure as codeProfessionalism2. An Introduction to Ruby .......................... 13What Is ruby?13Grammar and Vocabulary15Methods and Objects17Identifiers19More about methods22Classes25Arrays27Conditional logic30Hashes32Truthiness34Operator35Bundler373. An Introduction to chefExercise 1: Install Chef47Objectives47DirectionsWorked Example48Discussion49Exercise 2 Install a user54Objectives54Directions54ked Example54Discussion57Exercise 3 Install an IRC Client61ObjectiⅤes61Directions61Worked Example62Discussion664: Install Git70Objectives70Directions70orkedole71Discussion4. Using Chef with Tools81Exercise 1: Rub81obi81Directions81Worked Example82Discussion91Exercise 2: virtualbox106Objectives107Directions107Worked exampl107Discussion110E3:VgraI113Objectives113Directions113Worked Examplde114Discussion118Conclusio1225. An Introduction to Test-and Behavior-Driven Development125The Principles of Tdd and Bdd125A Very brief History of Agile Software Development125Test-Driven Development126Behavior-Driven Development127TDD and bdd with ruby129Minitest: Unit Testing for the 21st Century129Table of contentsRSpec: The Transition to BDD133Cucumber: Acceptance Testing for the Masses1386. A Test-Driven Infrastructure framework鲁自鲁155Test-Driven Infrastructure: A Conceptual Framework156Test-Driven Infrastructure Should Be mainstream156Test-Driven Infrastructure Should Be Automated157Test-Driven Infrastructure Should Be Side-Effect aware158Test-Driven Infrastructure Should be Continuously Integrated158Test-Driven Infrastructure Should Be Outside In159Test-Driven Infrastructure Should Be Test-First160The Pillars of Test-Driven Infrastructure161Writing Tests161Running tegests162Provisioning machines162Feedback of results1637. Test-Driven Infrastructure: A recommended toolchain,165Tool Selection166Unit testig167Integration Testing167ATesting168Testing Workflow170Supporting Tools: Berkshelf173Overview173Getting Started174Exampl175Advantages and disadvantages185Summary and conclusion186Supporting Tools: Test Kitchen186Overview186Getting Started187Summary and conclusion189Acceptance Testing: Cucumber and leibniz190Overview190Getting started192Example194Advantages and Disadvantage210Summary and conclusion212Integration Testing: Test Kitchen with Serverspec and Bats213Introducing bats220Introducing sgerverspec220Table of contentTemplates233Integration Testing: Minitest Handler243Overview244IngStarted245Epi251Advantages and Disadvantages257Summary and conclusion257Unit Testing: Chefsg257Overview258Getting Started259Example260Advantages and Disadvantages268Summary and conclusion269Static Analysis and linting tools270Overview270Getting Start271EⅩampi274Advantages and disadvantages279Summary and conclusion279o Conclude2798. Epilogue.,,,,,,281A. Bibliography.283Index28I Table of CePrefaceConventions Used in this bookThe following typographical conventions are used in this bookitalicIndicates new terms, URLS, email addresses, filenames, and file extensionsConstant widthUsed for program listings, as well as within paragraphs to refer to program elementssuch as variable or function names, databases, data types, environment variablesstatements, and keywordsConstant width boldShows commands or other text that should be typed literally by the userConstant width italicShows text that should be replaced with user-supplied values or by values determined by contextThis icon signifies a tip, suggestion, or general noteThis icon indicates a warning or cautionSafari books onlineSafari Books Online is an on-demand digital library that deliversSafariexpert content in both book and video form from the worlds lead-Books Online ing authors in technology and businessTechnology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification trainingSafari Books Online offers a range of product mixes and pricing programs for organi-zations, government agencies, and individuals. Subscribers have access to thousands ofbooks, training videos, and prepublication manuscripts in one fully searchable databasefrom publishers like O Reilly Media, Prentice Hall Professional, Addison-Wesley professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, JohnWiley Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FTPress, Apress, Manning, New Riders, McGraw-Hill, Jones Bartlett, Course Technol-ogy, and dozens more. For more information about Safari Books Online, please visit usonlineHow to Contact usPlease address comments and questions concerning this book to the publisherO Reilly media, Inc1005 Gravenstein Highway NorthSebastopol, Ca 95472800-998-9938(in the United States or Canada)707-829-0515 (international or local)707-829-0104(faxWe have a web page for this book, where we list errata, examples, and any additionalinformationYoucanaccessthispageathttp://oreil.ly/test-driven-infra-chef.To comment or ask technical questions about this book, send email to bookquestions@oreilly.comFor more information about our books. courses, conferences, and news, see our websiteathttp://www.oreilly.comFindusonFacebook:http:/lfacebook.com/oreillyFollowusonTwitterhttp://twitter.com/oreillymediaWatchusonyoUTubehttp://www.youtube.com/oreillymediaPreface
下载地址
用户评论